www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - align(n) not working

reply %u <wfunction hotmail.com> writes:
Hi,

I'm not sure if I'm doing something wrong, but it seems like struct alignment
isn't really working. When I execute this code:

	struct Temp
	{
		ubyte x;
		align(16) ubyte y;
	}
	auto o = Temp();
	std.stdio.writefln("Address of aligned fields: %#x, %#x", cast(size_t)&o.x,
cast(size_t)&o.y);

I get these addresses:
	0x18fd00, 0x18fd01
the second of which is not aligned on a 16-byte boundary.


Am I doing something wrong, or is this a bug?

Thank you!
Dec 27 2010
parent %u <wfunction hotmail.com> writes:
I just realized that this is an automated forum... just wanted to
say sorry about posting here, and thank you for bearing with this!
Dec 28 2010