[Issue 7396] Indicate default alignment with 0.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 30 08:06:40 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7396



--- Comment #11 from Daniel Green <venix1 at gmail.com> 2012-01-30 08:06:37 PST ---
(In reply to comment #9)
> The addition of an align(0) is not the right solution.

Currently,
    `align:` becomes`align(8)`.  Ambiguous. default alignment or 8 byte? 

Using 0,
    `align:` becomes `align(0)`.  Now if 0, default alignment is requested.

I'm not suggesting adding align(0).  I'm suggesting setting the internal
variable to 0 when default alignment is wanted.  The reason for this is the
knowledge that default alignment is required is only available to the parser
and not saved.

The biggest issue with this method is that if new code is added which uses the
structalign field of a scope block.  It must also check for 0.  This could be
alleviated by removing direct access to structalign and adding 2 member
functions.

Scope::alignsize() - return (structalign ? structalign : global.structalign);
Scope::isDefaultAlignment() - return !structalign


---

The original patch is designed to allow GDC to do what it's been doing without
breaking DMD or diverging the source more than necessary.  Since you have
suggested DMD should change to match gcc on gcc platforms.  It should be
considered invalid as any solution for DMD will solve the problem for GDC as
well.

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


More information about the Digitalmars-d-bugs mailing list