From -1998256737659672298 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc772,10e355266b6fd117 X-Google-Attributes: gidfc772,public X-Google-Thread: f78e5,10e355266b6fd117 X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 2002-07-12 09:12:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!denver-snf1.gtei.net!news.gtei.net!namche.sun.com!news2me.EBay.Sun.COM!engnews1.eng.sun.com!taumet!clamage From: "Baugereau" Newsgroups: comp.std.c++,comp.lang.c++.moderated Subject: Re: A humble attempt to suggest alignment support for C++ Date: 12 Jul 2002 16:06:34 GMT Organization: Wanadoo, l'internet avec France Telecom Lines: 50 Approved: stephen.clamage@sun.com (comp.std.c++) Message-ID: References: <3CEA1A08.C6D95CC7@lmf.ericsson.se> <53e3f3b2.0205270557.bdd703d@posting.google.com> Reply-To: "Baugereau" NNTP-Posting-Host: taumet.eng.sun.com X-NNTP-Posting-Host: afontenayssb-103-1-3-69.abo.wanadoo.fr X-Trace: wanadoo.fr 1026471251 13556 217.128.201.69 (12 Jul 2002 10:54:11 GMT) X-Complaints-To: abuse@wanadoo.fr NNTP-Posting-Date: 12 Jul 2002 10:54:11 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Content-Length: 1616 Originator: clamage@taumet Xref: archiver1.google.com comp.std.c++:12664 comp.lang.c++.moderated:46441 I quite agree but you often want to specify a different alignment for different allocations of the same type std::aligned_storage::type buffer[count] might be better (but I guess we can have a default parameter). "Gabriel Dos Reis" wrote in message news:m3bs9gu4hy.fsf@merlin.nerim.net... > > gneppert@web.de (McNepp) writes: > > | Yes, portable support for alignment is long overdue. > | But why not keep it as simple as possible? > | We want this declaration: > | > | char buffer[ count * sizeof(T) ]; > | > | to be a suitably aligned buffer for any type T. > | So what is really needed is just a simple specifier (e.g. "max_align") > | that does the trick: > | > | char max_align buffer[ count * sizeof(T) ]; > > I'm not (yet) convinced that a simple type specifier is necessary: A > library solution may suffice: > > std::aligned_storage::type buffer[count] > > with the requirement that std::aligned_storage::type be a synonymous > for char[sizeof (T)] with the additional attribute that it is suitably > aligned. No need for extra arithmetic. Robust. > > -- > Gabriel Dos Reis, dosreis@cmla.ens-cachan.fr > > > > [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ] > [ about comp.lang.c++.moderated. First time posters: do this! ] > > [ 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 ] > >