From 198480740741617131
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ab2ad36e6a93a642
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-05-30 11:15:47 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: andys@despammed.com (Andy Sawyer)
Newsgroups: comp.std.c++
Subject: Re: void variables
Date: Fri, 30 May 2003 18:15:45 +0000 (UTC)
Organization: International Rescue
Lines: 45
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <y90o4qzu.fsf@ender.evo6.com>
References: <D5mBa.12145$dP1.23487@newsc.telia.net> <li2dnYyXJNyTpEujXTWQlg@giganews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: mail2news.demon.co.uk 1054318546 26390 10.0.0.1 (30 May 2003 18:15:46 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Fri, 30 May 2003 18:15:46 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 19LoPm-0006rV-00
	for mail2news@news.news.demon.net; Fri, 30 May 2003 18:15:45 +0000
X-Received: by mulga.cs.mu.OZ.AU
	id EAA08941; Sat, 31 May 2003 04:15:39 +1000 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ucar.edu
X-User-Agent: GNUS/XEmacs
X-URL: http://www.evo6.com
X-SecretIdentity: Bratman, the Creped Crusader
X-Face: &ueGJEPHqNyD?*yp.j&mG@(B@zDH3qZ1P)wH{kDz"1Bkk(=t:aVLhX&3n_H(RXtvS}cEC%[
 Z7`:7uZiA=Q)rDNE9SlEBg'$\l8sXlg^l4#-|]p<dKV`/+ENXvoBv]`{Fy(A>&M7jpq=w3z?o3NXH^
 UZe+D'|+/wD1'g#=}<[=[1W\hi-]fMO|/n~Cr\h=AA'lOg}JTf0bK#Q#3I[L#,dqy^pTnps:TR3c_"
 ]WXetZ>^x$*sVj4s&uBOL.$H\TvY>B=ccsSeW}L^y@A(d.(4vdO8lsH6TJO(UL;,o#rl[t5N|./
X-Attribution: AMS
X-DoML: 14148
X-DDate: Setting Orange, Day 4 of the season of Confusion, Anno Mung 3169
X-Newsgroups: comp.std.c++
X-NNTP-Posting-Date: Fri, 30 May 2003 12:24:08 BST
X-Spam-Status: No, hits=-9.4 required=5.0
	tests=EMAIL_ATTRIBUTION,NOSPAM_INC,REFERENCES,
	      SIGNATURE_SHORT_DENSE,SPAM_PHRASE_00_01,USER_AGENT
	version=2.41
Xref: archiver1.google.com comp.std.c++:19576

In article <li2dnYyXJNyTpEujXTWQlg@giganews.com>,
 on Thu, 29 May 2003 17:09:29 +0000 (UTC),
 ron@sensor.com ("Ron Natalie") wrote:

> Gak, then
>     void foo[10];
> has a lot of problems.

Whilst I have no interest in "completing" void as a type, in the past
I've thought it might be handy to be able to declare "arrays of void",
as "typeless" buffers which give alignment guarantees, e.g.:

   void foo[10];

This would be big enough to construct an object whose size <= 10, and
(here's the important bit) would be guaranteed to be correctly aligned
to do so. Currently, the only way to aquire such a buffer is to
allocate it dynamically, and I sometimes feel that it might be nice to
be able to declare an automatic buffer to deal with this kind of
thing.

e.g.:

void foo( const widget& w )
{
   void buffer[sizeof(widget)]; // correctly aligned for
                                // construction of any type
   widget *p = new (buffer) widget(w);
// do stuff with *p
}


Regards,
 Andy S.
-- 
"Light thinks it travels faster than anything but it is wrong. No matter
 how fast light travels it finds the darkness has always got there first,
 and is waiting for it."                  -- Terry Pratchett, Reaper Man

---
[ 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                       ]



