From -4247221523146107874
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc772,e4551d1072848803
X-Google-Attributes: gidfc772,public
X-Google-Thread: f78e5,e4551d1072848803
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-12-15 22:59:48 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news1.optus.net.au!optus!news.mel.connect.com.au!news.unimelb.edu.au!bounce-back
From: tom_usenet@hotmail.com (Tom)
Newsgroups: comp.std.c++,comp.lang.c++.moderated
Subject: Re: Omitting the access specifier of a base class
Date: 16 Dec 01 06:59:23 GMT
Organization: ntlworld News Service
Lines: 39
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
Message-ID: <3c1aa1bb.1476763@news.ntlworld.com>
References: <3C051430.3AE0E9C2@bawi.org>
  <3C061364.9968E1B3@s2.chalmers.se>
  <3c06ea42.15047417@news.ntlworld.com>
  <156b8737.0112111616.748fc4b8@posting.google.com>
NNTP-Posting-Host: mundook.cs.mu.oz.au
X-Trace: ariel.ucs.unimelb.edu.au 1008485981 28664 128.250.29.16 (16 Dec 2001 06:59:41 GMT)
X-Complaints-To: news@news.unimelb.edu.au
NNTP-Posting-Date: 16 Dec 2001 06:59:41 GMT
X-Original-Date: 15 Dec 2001 05:08:30 -0500
X-Submission-Address: c++-submit@netlab.cs.rpi.edu
X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated
	iQBVAwUAPBshGUHMCo9UcraBAQFKWAH/VBuKv87FLvTlDWPBZ1MH0/xtSgueXkDS
	4WTatLeX1bTgA5yaccsnPVhQjalYO8WnraBxnmMhjoz/f6zbmbiOTQ==
	=pRGf
X-WARNING-TO-MODERATORS: This article has been processed and
    accepted using a cryptographic program by the moderator
    of comp.lang.c++.moderated. Its content must not be changed or it
    will be automatically cancelled. If you don't like the
    article or its crossposting, return it to the submitter. 
    (You can delete this message if you are the last
    moderator to see it.)
X-Approved-For-Group: francis.moderator@robinton.demon.co.uk comp.lang.c++.moderated
X-Auth: PGPMoose V1.1 PGP comp.std.c++
	iQBFAgUAPBxGTuEDnX0m9pzZAQFr/wF/TUn4/ZNj84Xk/TOBRBCPv2HmZWOquL3O
	qGvRoH0rSlmTnEKC1VpnswwUEig1MOZU
	=haVK
Xref: archiver1.google.com comp.std.c++:8643 comp.lang.c++.moderated:32847

On 12 Dec 2001 11:42:47 -0500, dylan@moldflow.com (Dylan Nicholson)
wrote:

 >tom_usenet@hotmail.com (Tom) wrote in message news:<3c06ea42.15047417@news.ntlworld.com>...
 >> On 29 Nov 2001 18:01:22 -0500, Martin Fabian
 >> <fabianNOSPAM@s2.chalmers.se> wrote:
 >>
 >> >Since you (well, me, at least :-) almost always add constructors to the
 >> >c++structs, the c++/c-struct compatibility feature seems to be of
 >> >limited value. I guess it was (is?) most useful during the transition
 >> >from c to c++.
 >>
 >> And for fast, non-portable binary IO which I certainly need a lot
 >> (yes, I did profile before deciding to do this). If you add
 >> constructors you no longer have a POD struct, so you can't just memcpy
 >> it around. Why call memcpy for each member of a class when you can do
 >> the whole lot in one go if you have a POD struct.
 >>
 >
 >Actually I usually add constructors to structs I'm using just as data,
 >but only for the purpose for easy initialisation of members.  Why
 >shouldn't it be safe to memcpy that around?

Define safe. The C++ standard disallows it AFAIK. It is only allowed
for POD data, and POD data can't have constructors.  OTOH, I expect it
works on all current implementations.

I think 3.8 and 3.9 of the standard make this restriction clear(ish).

Tom

      [ 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.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]


