Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-05-03 09:51:17


John Maddock wrote:
>
> >but the constant value of '_MAX_ALIGN' must be set
> >manually by the client. This isn't really acceptable.
> >It would be useful if an appropriate value were available
> >in the boost library.
>
> I don't think it can be unambiguously calculated, but given:
>
> union max_align
> {
> int i;
> long l;
> long long ll;
> double d;
> long double ld;
> };
>
> Then:
>
> boost::alignment_of<max_align>::value
>
> should be somewhere near it.

        Since the calculation isn't definite, I'd prefer to see
a constant

        MAX_ALIGN

        or perhaps

        boost::max_align

included in the library somewhere. I must repeat that this
value is absolutely fundamental to all routines that
suballocate memory. In particular, I noticed a
Pool suballocator in boost: it cannot possibly be portable ISO C++
without this constant. It's a requirement of any allocator that
the returned address be suitable for instantiating _any_ data type.

-- 
John (Max) Skaller, mailto:skaller_at_[hidden]
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk