Use of `pointer`

No, please, not my pointers! Snippets like the above are invaluable for peeking under the hood and understanding how internals work; and they are useful for interfacing C, and also sometimes nice for performance (even though I understand why you consider getindex/setindex! for pointers as too convenient for Base).

I take the segfault before a deprecation every day.

, or shall write something to turn more of the obvious ones into throws (we should know at compile-time that Unions cannot be unsafe_loaded from a pointer, zero runtime overhead but unsafe_load would need to become generated; I don’t see an obvious way to split throw vs pointerref on dispatch).

edit: Huh. Apparently unsafe_load of unions does make sense sometimes (it assumes a different layout that array elements). So what I proposed can probably not be done; that’s life, this is an easy segfault to avoid.

1 Like