[Issue 3183] Spec of align attribute needs work

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3183

Andrei Alexandrescu  changed:

   What|Removed |Added

Version|unspecified |D2

--


[Issue 3183] Spec of align attribute needs work

2009-09-03 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3183


Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED




--- Comment #3 from Walter Bright   2009-09-03 
13:26:26 PDT ---
Fixed dmd 1.047 and 2.032

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3183] Spec of align attribute needs work

2009-08-31 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3183





--- Comment #2 from Stewart Gordon   2009-08-31 04:57:28 PDT ---
(In reply to comment #1)
> 2. There's always a companion C compiler, as D relies on the existence of the 
> C
> runtime library.

So a prerequisite for writing a D compiler from scratch is to write a C
compiler first?  Still, that doesn't answer my question beyond the first 7
words.

> 3. It's the way the companion C compiler aligns.

Still, that this may be absolute or relative depending on the companion C
compiler ought to be mentioned in the D spec at least to crack down on the user
confusion of which I have been a victim.

> 4. Unions members are all at offset 0. Unions are aligned according to the
> alignment of their largest field.

You mean aligned in a containing struct, or aligned absolutely _if_ the
implementation interprets alignment as absolute?  Neither seems to be happening
in my test (1.046):

--
align(1) struct Qwert {
byte b1;
align(1) struct {
byte b2;
union {
align (4) struct { int i; }
}
}
}

pragma(msg, "Qwert.alignof == " ~ Qwert.alignof.stringof);
pragma(msg, "Qwert.b1.alignof == " ~ Qwert.b1.alignof.stringof);
pragma(msg, "Qwert.b2.alignof == " ~ Qwert.b2.alignof.stringof);
pragma(msg, "Qwert.i.alignof == " ~ Qwert.i.alignof.stringof);
pragma(msg, "Qwert.b1.offsetof == " ~ Qwert.b1.offsetof.stringof);
pragma(msg, "Qwert.b2.offsetof == " ~ Qwert.b2.offsetof.stringof);
pragma(msg, "Qwert.i.offsetof == " ~ Qwert.i.offsetof.stringof);
--
Qwert.alignof == 1u
Qwert.b1.alignof == 1u
Qwert.b2.alignof == 1u
Qwert.i.alignof == 4u
Qwert.b1.offsetof == 0u
Qwert.b2.offsetof == 1u
Qwert.i.offsetof == 2u
--

But to both 4 and 5, I said "should", i.e. I was pondering over what's
desirable and whether the spec ought to be changed, not what the current spec
or behaviour is.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3183] Spec of align attribute needs work

2009-08-31 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3183


Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com




--- Comment #1 from Walter Bright   2009-08-31 
02:44:07 PDT ---
1. C ABI compatibility.

2. There's always a companion C compiler, as D relies on the existence of the C
runtime library.

3. It's the way the companion C compiler aligns.

4. Unions members are all at offset 0. Unions are aligned according to the
alignment of their largest field.

5. It is ignored for non-struct fields.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---