Date: 2001-10-28 19:05:33
--- In boost_at_y..., Douglas Gregor <gregod_at_c...> wrote:
> On Sunday 28 October 2001 07:59, you wrote:
> > That's good news, but alignof will be quite useless without a
> > corresponding #pragma align.
> > In any case, having a boost library solution would still be
> > both as an interim measure and to gauge the need for the language
> > extension.
> > (actually, something like the Microsoft declspec(align(N)) syntax
> > would probably be better than the #pragma I suggested above.)
> A pragma would help all that much, because the condition is
> early (preprocessing time). To construct a stack-based variant
class we need
> to be able to determine the alignment when we instantiate.
That's true- although the #pragma syntax could probably be made to
work if its meaning was defined as essentially adding the vendor-
specific alignment declaration (e.g. Microsoft's declspec(align(N)))
to the next declaration. But I agree it is not ideal.
> I personally don't see much of a reason to add this capability into
> language. It is clearly possible from the library standpoint once
we have an
> accurate alignof().
I don't think alignof() is either sufficient or necessary for
aligning stack memory.
It is not sufficient as, to design an alignment_traits<>::align_t
style of class, one needs a guarantee that the finite set of built-in
types covers all alignment possibilities, but this is not guaranteed
by the language.
It is not necessary as evidenced by the implementation of
alignment_traits<>::align_t which I submitted- it doesn't use alignof
Though I tend to agree that if the only use for the proposed language
extentions was to align stack memory, then the need is probably not
great enough to justify a language extension and a standardised
std::alignment_traits<>::align_t and std::alignment_traits<>::value
would be enough support.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk