Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: Is this really necessary
Date: Sat, 07 Aug 2021 10:22:00 -0700
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <8635rl41c7.fsf@linuxsc.com>
References: <87r1hevbc8.fsf@nosuchdomain.example.com> <87y2bmphoo.fsf@nosuchdomain.example.com> <86pmwxd3qq.fsf@linuxsc.com> <77334d48-26bb-4ea4-b515-34a59e372397n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="0a1d8104bbc0e7f8706fc1dabce7c8e9"; logging-data="22220"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19FNicalYgvM7R27AoqwyvS22WFgDJ3UGI="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:vpyFpZGMsWygTtEelRR+tBq+5oo= sha1:lEswUXR8vuL1RlG6SsWK34YLX+E=
Xref: csiph.com comp.lang.c++:80785
"james...@alumni.caltech.edu" writes:
> On Monday, June 7, 2021 at 12:44:12 PM UTC-4, Tim Rentsch wrote:
> ...
>
>> In C a pointer to any object can be converted to unsigned char *
>> which then can be used as though it were pointing into a
>> character array whose extent covers the entire object.
>>
>> Do you have some reason to believe that property does not apply
>> to C++?
>
> "An object of trivially copyable or standard-layout type (6.8) shall
> occupy contiguous bytes of storage." (6.7.2p8.4). Which implies
> that any type that is neither trivially copyable nor a
> standard-layout type need not occupy contiguous bytes of storage.
> C's requirement (6.2.6.1p2) has no such exceptions.
Sorry, I thought it was obvious from context that my
question was meant to ask only about contiguous objects.