December 05, 2015 Re: Neat project: add pointer capability to std.bitmanip.bitfields | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Saturday, 5 December 2015 at 04:34:03 UTC, Steven Schveighoffer wrote:
> I think what Vladimir is referring to is an align(1) struct:
>
> struct Foo
> {
> align(1):
> ubyte a;
> int b;
> }
>
> Foo foo;
> int *ptr = &foo.b; // not pointing at aligned integer
>
> I think we should identify that tagged* does not support such pointers, and probably the ctor should assert this situation isn't occurring.
>
> -Steve
Yeah that is unsafe. What will happen is very architecture dependent to boot, even if you don't use the bitfield thing. That should probably not be safe.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply