From 6531138779495987301 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,10e355266b6fd117 X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 2002-07-14 19:05:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.alt.net!comp-std-cpp-robomod!not-for-mail From: terekhov@web.de (Alexander Terekhov) Newsgroups: comp.std.c++ Subject: Re: A humble attempt to suggest alignment support for C++ Date: 15 Jul 2002 02:05:14 GMT Organization: http://groups.google.com/ Lines: 92 Approved: Fergus Henderson , moderator of comp.std.c++ Message-ID: References: <3CEA1A08.C6D95CC7@lmf.ericsson.se> <53e3f3b2.0205270557.bdd703d@posting.google.com> <3D2ECDEE.33EE6D72@web.de> <3D306952.C418FC82@web.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Return-Path: X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov) X-Trace: posting.google.com 1026696217 6605 127.0.0.1 (15 Jul 2002 01:23:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 15 Jul 2002 01:23:37 GMT Xref: archiver1.google.com comp.std.c++:12698 Gabriel Dos Reis wrote in message news:... > Alexander Terekhov writes: > > | Gabriel Dos Reis wrote: > | > > | > Alexander Terekhov writes: > | > > | > [...] > | > > | > | > I'm not (yet) convinced that a simple type specifier is necessary: A > | > | > library solution may suffice: > | > | > > | > | > std::aligned_storage::type buffer[count] > | > | > | > | aligned_storage_pod(T) buffer; // implementation-defined POD type > | > > | > std::aligned_storage::type is such a POD. What else am I missing? > | > | Uhmm. You wrote: > | > | http://groups.google.com/groups?selm=m3bs9gu4hy.fsf%40merlin.nerim.net > | > | : requirement that std::aligned_storage::type be a synonymous > | : for char[sizeof (T)] with the additional attribute that it is suitably > | : aligned. > | > | I personally don't need it to be "synonymous for char[sizeof (T)]" > | with some magic [w.r.t. conventional chars] "additional attribute > | that it is suitably aligned". > | > | An 'opaque' POD type would be 'sufficient', I think. > > Well, "an opaque POD type" is also a magic. I mean that (for example): struct Something : virtual AnotherSomething { /**/ }; class FancyDouble { double value; public: Double(); Double( const Double& ); Double& operator=(const Double&); ~Double(); }; could then result in (provided/"defined" by the implementation): union __Something_aligned_storage_pod { some_pod __align; char __mass[ sizeof( Something ) ]; }; union __FancyDouble_aligned_storage_pod { double __align; }; Uhmm. I don't see any magic attributes here. > And if all you want is to have a POD type, then you can safely ignore > about the additional alignment atttibute. > > [...] > > | http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Alignment.html#Alignment > > I'll well aware of this. That might be one of the reason why I'm not > convinced of the need to introduce a core language extention. > > Actually, I'm envisioning support for "alignment" storage in the > library having two components: > > 1) std::aligned_storage::type; Is this an array or what? ;-) > 2) std::type_traits::alignment. Yeah, and perhaps: MT_std::type_traits< void >::memory_granularity. ;-) ;-) regards, alexander. --- [ 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.jamesd.demon.co.uk/csc/faq.html ]