🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: pointer comparisons

#1396
From: Jim Adcock
Date: Tue, 05 Jan 1993 00:49
19 lines
1526 bytes
|In article <9300300.29900@mulga.cs.mu.OZ.AU> (Fergus James HENDERSON) 
|writes:
|>   "The _sizeof_ operator yields the size, in bytes, of its operand".
|> I think that it would be a very brave compiler-writer whose compiler
|> made it unreliable to write() an object and read() it in again, because
|>   read(fd, &object, sizeof object);
|> randomly trashes the bytes past the end of the object.

Yet in the example I posted of a vacuous baseclass and a first member
of the base type, no such problem exists.  Sizeof == 1.  Bytes required
within the structure by the baseclass "subobject" == 0.  
And read(fd, &object, sizeof object) *does not* randomly trash the bytes
past the end of the object.  Further, this implementation is consistent
with the ANSI-C base document *mandate* that implementations do not
introduce padding into a structure before the first member. 
ANSI-C mandates that the address of the first member be the same as the 
address of the structure.  Unless there is overriding reason in the ARM
why this cannot be the case, then the ANSI-C base document ought to be
respected.  My claim is that there is no such overriding ARM requirement.
Technical Details
Message-ID: <1993Jan05.004950.12883@microsoft.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!microsoft!hexnut!jimad
References: <1993Jan2.211538.11320@lpi.liant.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!microsoft!hexnut!jimad
From: jimad@microsoft.com (Jim Adcock)
Subject: Re: pointer comparisons
Message-ID: <1993Jan05.004950.12883@microsoft.com>
Date: 05 Jan 93 00:49:50 GMT
Organization: Microsoft Corporation
References: <1993Jan2.211538.11320@lpi.liant.com>
Distribution: usa
Lines: 20