# Safety of returning an array with Address elsewhere

**URL:** <https://forum.ada-lang.io/t/safety-of-returning-an-array-with-address-elsewhere/1580>\
**Category:** General\
**Tags:** ada\
**Created:** [December 11, 2024, 10:02pm UTC](https://forum.ada-lang.io/t/safety-of-returning-an-array-with-address-elsewhere/1580 "2024-12-11T22:02:49Z")\
**Posts on this page:** 1\
**Showing post:** 27

<div class="post-metadata">

**Author:** ![OneWingedShark](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/onewingedshark/32/305_2.png) [@OneWingedShark](https://forum.ada-lang.io/u/OneWingedShark)\
**Post date:** [December 14, 2024, 5:08am UTC](https://forum.ada-lang.io/t/safety-of-returning-an-array-with-address-elsewhere/1580/27 "2024-12-14T05:08:16Z")

</div>

> [@jcmoyer](#):
>
> That explains a lot. I’m not really interested in using GNATCOLL. I am mostly just curious about how much Ada lets you cut through the safety features.

There are features that are inherently you-need-to-know-what-you’re-doing “unsafe” —even this version of ‘unsafe’ is typically less dangerous than, say, C’s _you mistyped a symbol, gotcha!_-style “unsafe”— like `Unchecked_Deallocation` (guaranteed idempotent, so there is no “double free” issue), or `Unchecked_Conversion` (telling the compiler use value-X of type-Y as type-Z), overlay (import+address; essentially unchecked\_conversion), representation-clauses (telling the compiler _“use **this** memory layout”_), and a few other low-level features.

Insofar as memory goes, [this video](https://archive.fosdem.org/2016/schedule/event/ada_memory/) is excellent. I have two posts on unconstrained arrays/strings ([here](https://forum.ada-lang.io/t/how-to-use-strings-in-ada/1317/4) & [here](https://forum.ada-lang.io/t/initializing-an-array-of-strings/1359/4)) that should be informative to one of the big, fundamental differences in Ada from other languages.

The key to really using Ada well is this: use the type-system to model your problem, then use _that_ to solve your problem. There is a little bit of an art in designing, but that’s generally true everywhere.

---

_[View the full topic](https://forum.ada-lang.io/t/safety-of-returning-an-array-with-address-elsewhere/1580)._
