 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Larry Guest
|
Posted: Tue May 08, 2007 3:12 am Post subject: adding alignment support n2140 & n2165 inconsistent alignmen |
|
|
===================================== MODERATOR'S COMMENT:
Apologies for the delay in moderation; this appears to be caused
by my ISP (Cox) dropping and/or blocking e-mail.
===================================== END OF MODERATOR'S COMMENT
Sorry if the following appears more than once. I sent it but
got no response in 24 hrs; so, I'm resubmitting.
--- original message: ---
According to the table on:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/#mailing2007-03
the document:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2140.pdf
is the predecessor to the document:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2165.pdf
According to n2165, page. 10, aligned_storage::alignment_value is:
the least common multiple of all Alignments
However, according to n2140, page 5, aligned_storage::alignment_value
is the "largest digit that is set" in "the binary-ors all Alignments".
I can understand n2165; however, I don't understand n2140. The
largest bit set is a number from 0 to 31 on a 32 bit machine. So, if
the only element in an aligned_union is an int, with alignment 4, then
the largest digit set of binary-or of 4 is 2, and 2 is the wrong
alignment for an int. OTOH, if n2140 meant 2 raised to the power of
the largest digit that is set, then it would make more sense, but
this, AFAICT, would not be the same as the least common multiple. So,
is n2140 wrong? In addition, if all alignments are 2 raised to some
unsigned power (as required by paragraph 4 on page 5 of n2140) then
wouldn't the max of all alignments give the correct alignment for the
union? OTOH, if the extended alignments (page 3 of n2165) were
allowed, then least common multiple instead of max would be the
correct method for calculating the composite (union) alignment. So,
is lcm instead of max used on page 10 to accommodate extended
alignments?
TIA.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
jg Guest
|
Posted: Thu May 10, 2007 10:57 pm Post subject: Re: adding alignment support n2140 & n2165 inconsistent alig |
|
|
===================================== MODERATOR'S COMMENT:
===================================== END OF MODERATOR'S COMMENT
On May 7, 8:12 pm, Larry <cppljev...@suddenlink.net> wrote:
| Quote: | ===================================== MODERATOR'S COMMENT:
Apologies for the delay in moderation; this appears to be caused
by my ISP (Cox) dropping and/or blocking e-mail.
===================================== END OF MODERATOR'S COMMENT
Sorry if the following appears more than once. I sent it but
got no response in 24 hrs; so, I'm resubmitting.
--- original message: ---
According to the table on:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/#mailing2007-03
the document:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2140.pdf
is the predecessor to the document:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2165.pdf
According to n2165, page. 10, aligned_storage::alignment_value is:
the least common multiple of all Alignments
However, according to n2140, page 5, aligned_storage::alignment_value
is the "largest digit that is set" in "the binary-ors all Alignments".
I can understand n2165; however, I don't understand n2140. The
largest bit set is a number from 0 to 31 on a 32 bit machine. So, if
the only element in an aligned_union is an int, with alignment 4, then
the largest digit set of binary-or of 4 is 2, and 2 is the wrong
alignment for an int. OTOH, if n2140 meant 2 raised to the power of
the largest digit that is set, then it would make more sense, but
this, AFAICT, would not be the same as the least common multiple. So,
|
I didn't read the document, instead of answering your question, I am
just saying mine.
If all the alignment is 2's power, I think the lcm is the same as
largest digit
that is set" in "the binary-ors all Alignments". (assume n2140 means
2's power.)
In practice, is there any alignment that is not 2's power ?
JG
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
Larry Evans Guest
|
Posted: Sun May 13, 2007 2:47 am Post subject: Re: adding alignment support n2140 & n2165 inconsistent alig |
|
|
On 05/10/2007 05:57 PM, jg wrote:
[snip]
| Quote: | In practice, is there any alignment that is not 2's power ?
|
If boost::alignment_of is correct, then apparently so:
http://archives.free.net.ph/message/20051026.011808.725ad7bb.en.html
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ] |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|