Neat project: add pointer capability to std.bitmanip.bitfields
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Sat Dec 5 00:42:27 PST 2015
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.
More information about the Digitalmars-d
mailing list