🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2784

Re: an optimization I claim is illegal

#2784
From: Dick Menninger
Date: Tue, 28 Nov 1995 22:41
40 lines
2028 bytes
> ==========Fergus Henderson, 11/28/95==========
 
> > Dick Menninger <Dick.Menninger@daytonoh.attgis.com> writes:
 
> >> ==========Fergus Henderson, 11/21/95==========
 
> >> If you changed the line
> >>      D1 d1 (7);
> >> to
> >>      D1 &d1 = *(D1 *) malloc(sizeof(D1) + sizeof(D2));

This needs only be max of the two sizes.
My brain went a little south on seeing the above.

> >>      new (&d1) D1 (7);
 
[ stuff deleted ]
 
> My reading of the draft confirms your impression.
 
> Nevertheless, the code does ensure correct alignment.
> The reason is that there is an implicit conversion to `void *'
> in the call to placement new.  This implicit conversion is defined
> to return the address of the start of the storage of the object,
> i.e. the address of the first byte (4.10/2 [conv.ptr]).

Thanks.
That makes sense.
I guess the fat goes to my brain
instead of the waist like other people.

Good Day
Dick
Dick.Menninger@DaytonOH.ATTGIS.COM


[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <DIrynI.AxM@falcon.daytonoh.attgis.com>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <9533300.5218@mulga.cs.mu.OZ.AU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: Dick Menninger <Dick.Menninger@daytonoh.attgis.com>
Newsgroups: comp.std.c++
Subject: Re: an optimization I claim is illegal
Date: 28 Nov 1995 22:41:16 GMT
Organization: AT&T Global Information Solutions
Sender: News administrative Login <news@falcon.daytonoh.attgis.com>
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <DIrynI.AxM@falcon.daytonoh.attgis.com>
References: <9533300.5218@mulga.cs.mu.OZ.AU>
Reply-To: mennid <Dick.Menninger@daytonoh.attgis.com>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: 149.25.99.44
X-Newsreader: DiscussIT 2.5.1.3 for MS Windows [AT&T Software Products Division]
To: undisclosed-recipients.;@daytonoh.attgis.com
Content-Length: 953
X-Lines: 36
Originator: clamage@taumet