[Issue 3183] New: Spec of align attribute needs work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 16 14:37:07 PDT 2009


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

           Summary: Spec of align attribute needs work
           Product: D
           Version: unspecified
          Platform: All
               URL: http://www.digitalmars.com/d/archives/digitalmars/D/Sp
                    ec_of_align_attribute_is_a_mess_88129.html
        OS/Version: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: smjg at iname.com
            Blocks: 677,3118


There are ambiguities and inconsistencies in how the align attribute is
described in the D specification.  What follows is a cut-down version of the
unanswered post at the given URL, with a few bits thrown in from other posts.

1. Is the whole purpose of it for portability of data or for C ABI
compatibility?

ctod.html:
"Clearly, since much of the point to setting alignment is for 
portability of data, a portable means of expressing it is necessary."

attribute.html:
"AlignAttribute is meant for C ABI compatiblity [sic], which is not the 
same thing as binary compatibility across diverse platforms. For that, 
use packed structs:"

2. attribute.html describes align as matching the behaviour of the companion C
compiler.  What if there's no companion C compiler, or the companion C compiler
doesn't support alignment control at the level it has been used in the D code?

3. I had for ages made out align to be purely about the relative alignment of
members within a struct.  But a discussion at
http://tinyurl.com/nqs2n3#N87948
(that message onwards) got me confused until I realised that people were
interpreting it as absolute alignment.  The spec doesn't clarify one way or the
other.  Which is it meant to be?

4. Following on from point 3, should it apply only to structs as is currently
documented?  Or should it work on unions as well?  Even arbitrary variable
declarations?

5. And how should the compiler handle it if used where inapplicable?  There are
the odd bits in the spec on this, but it wants rethinking.  This is just one
case of issue 3118.

-- 
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