Re: The great inapplicable attribute debate

2009-04-14 Thread Frits van Bommel
Christopher Wright wrote: Frits van Bommel wrote: But the union's alignment needs to be sufficient for all members, so it depends on the maximum alignment of all members. Or the least common multiple, assuming that align accepts arguments that are not powers of 2. I have never seen "alignme

Re: The great inapplicable attribute debate

2009-04-14 Thread Christopher Wright
Frits van Bommel wrote: Stewart Gordon wrote: Don wrote: Stewart Gordon wrote: Surely, align isn't applicable to unions at all. IINM the members of a union, by design, start at the same offset. Not so, the alignment of each member should be respected. But the offset of a union member i

Alignment of unions (was: The great inapplicable attribute debate)

2009-04-14 Thread Stewart Gordon
Frits van Bommel wrote: Stewart Gordon wrote: But the offset of a union member is always zero. So what would this do? It should make sure the union is aligned appropriately in a containing struct, meaning U.alignof >= M.alignof for all members M. Specifying per-member alignment allows you

Re: The great inapplicable attribute debate

2009-04-14 Thread Frits van Bommel
Stewart Gordon wrote: Don wrote: Stewart Gordon wrote: Surely, align isn't applicable to unions at all. IINM the members of a union, by design, start at the same offset. Not so, the alignment of each member should be respected. But the offset of a union member is always zero. So what w

Re: The great inapplicable attribute debate

2009-04-14 Thread Stewart Gordon
Don wrote: Stewart Gordon wrote: Surely, align isn't applicable to unions at all. IINM the members of a union, by design, start at the same offset. Not so, the alignment of each member should be respected. But the offset of a union member is always zero. So what would this do? Most ob

Re: The great inapplicable attribute debate

2009-04-14 Thread Don
Stewart Gordon wrote: Unions are normally aligned to the maximum alignment for any member. Now consider: union U { align(1) void* p; ubyte[size_t.sizeof] bytes; } union U2 { align(4) ubyte[12] data; char[12] str; } What are U.alignof and U2.alignof? According to that piece of t

Re: The great inapplicable attribute debate

2009-04-14 Thread Frits van Bommel
Michel Fortin wrote: On 2009-04-13 09:43:53 -0400, Frits van Bommel said: (How does this combine with the "D ABI" anyway? I know binary compatibility between the different compilers is a bit of a pipe dream at the moment, but the only way that could work would be to standardize any and all

Re: The great inapplicable attribute debate

2009-04-14 Thread Michel Fortin
On 2009-04-13 09:43:53 -0400, Frits van Bommel said: (How does this combine with the "D ABI" anyway? I know binary compatibility between the different compilers is a bit of a pipe dream at the moment, but the only way that could work would be to standardize any and all shuffling of class fie

Re: The great inapplicable attribute debate

2009-04-13 Thread Tomas Lindquist Olsen
On Mon, Apr 13, 2009 at 3:00 PM, Denis Koroskin <2kor...@gmail.com> wrote: > On Mon, 13 Apr 2009 16:44:25 +0400, Tomas Lindquist Olsen > wrote: > >> On Mon, Apr 13, 2009 at 2:05 PM, Frits van Bommel >> wrote: >>> >>> Kagamin wrote: Stewart Gordon Wrote: > At the moment, the pro

Re: The great inapplicable attribute debate

2009-04-13 Thread Stewart Gordon
Frits van Bommel wrote: Stewart Gordon wrote: [rearrangement of class fields] Right, forgot about that bit. Probably because AFAIK no D compiler actually reorganizes them... (How does this combine with the "D ABI" anyway? I know binary compatibility between the different compilers is a bi

Re: The great inapplicable attribute debate

2009-04-13 Thread Frits van Bommel
Stewart Gordon wrote: Frits van Bommel wrote: Kagamin wrote: Such mood was always in the spec: "AlignAttribute is ignored when applied to declarations that are not structs or struct members". I never saw that before. So it doesn't work for class members? http://www.digitalmars.com/d/1.0/c

Re: The great inapplicable attribute debate

2009-04-13 Thread Denis Koroskin
On Mon, 13 Apr 2009 16:44:25 +0400, Tomas Lindquist Olsen wrote: On Mon, Apr 13, 2009 at 2:05 PM, Frits van Bommel wrote: Kagamin wrote: Stewart Gordon Wrote: At the moment, the problem seems to be that the compiler is silently ignoring many cases of (a), (b) and (c) alike. Some people

Re: The great inapplicable attribute debate

2009-04-13 Thread Stewart Gordon
Frits van Bommel wrote: Kagamin wrote: Such mood was always in the spec: "AlignAttribute is ignored when applied to declarations that are not structs or struct members". I never saw that before. So it doesn't work for class members? http://www.digitalmars.com/d/1.0/class.html "The D compil

Re: The great inapplicable attribute debate

2009-04-13 Thread Tomas Lindquist Olsen
On Mon, Apr 13, 2009 at 2:05 PM, Frits van Bommel wrote: > Kagamin wrote: >> >> Stewart Gordon Wrote: >> >>> At the moment, the problem seems to be that the compiler is silently >>> ignoring many cases of (a), (b) and (c) alike.  Some people argue that the >>> spec doesn't forbid such use of inapp

Re: The great inapplicable attribute debate

2009-04-13 Thread Frits van Bommel
Kagamin wrote: Stewart Gordon Wrote: At the moment, the problem seems to be that the compiler is silently ignoring many cases of (a), (b) and (c) alike. Some people argue that the spec doesn't forbid such use of inapplicable attributes explicitly, and so the compiler's treatment of these can

Re: The great inapplicable attribute debate

2009-04-13 Thread Kagamin
Stewart Gordon Wrote: > At the moment, the problem seems to be that the compiler is silently > ignoring many cases of (a), (b) and (c) alike. Some people argue that > the spec doesn't forbid such use of inapplicable attributes explicitly, > and so the compiler's treatment of these cannot be ca

Re: The great inapplicable attribute debate

2009-04-12 Thread BCS
Hello grauzone, BCS wrote: Just my $0.02 because that might make things less complex. And if you want to remove complexity, start with the bigger chunks of the D language. complexity re the OP's point, not just in general. if only (i) is allowed then there isn't (much of) a case for allo

Re: The great inapplicable attribute debate

2009-04-12 Thread grauzone
BCS wrote: Hello Stewart, Perhaps what complicates matters further is that D has three ways of specifying attributes: (i) as part of the declaration itself I more or less only use this. (ii) in a block delimited by { } If I remembered that this one even exists, I might use it. (iii) wi

Re: The great inapplicable attribute debate

2009-04-12 Thread Nick Sabalausky
"BCS" wrote in message news:a6268ff4a7a8cb89c641dc8...@news.digitalmars.com... > Hello Stewart, > >> Perhaps what complicates matters further is that D has three ways of >> specifying attributes: >> >> (i) as part of the declaration itself > > I more or less only use this. > >> (ii) in a block de

Re: The great inapplicable attribute debate

2009-04-12 Thread Nick Sabalausky
"Stewart Gordon" wrote in message news:grtr90$1hl...@digitalmars.com... > It's cropped up on a number of occasions. And again in the comments on > http://d.puremagic.com/issues/show_bug.cgi?id=2830 > http://d.puremagic.com/issues/show_bug.cgi?id=1441 > which are essentially the same as each othe

Re: The great inapplicable attribute debate

2009-04-12 Thread BCS
Hello Stewart, Perhaps what complicates matters further is that D has three ways of specifying attributes: (i) as part of the declaration itself I more or less only use this. (ii) in a block delimited by { } If I remembered that this one even exists, I might use it. (iii) with a colon t

The great inapplicable attribute debate

2009-04-12 Thread Stewart Gordon
It's cropped up on a number of occasions. And again in the comments on http://d.puremagic.com/issues/show_bug.cgi?id=2830 http://d.puremagic.com/issues/show_bug.cgi?id=1441 which are essentially the same as each other. The basic matter of debate is: If an attribute is applied to something to wh