Re: Union C++ standard

Derek Jones <derek@NOSPAM-knosof.co.uk>
Sun, 28 Nov 2021 12:51:14 +0000

          From comp.compilers

Related articles
Union C++ standard DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2021-11-25)
Re: Union C++ standard 480-992-1380@kylheku.com (Kaz Kylheku) (2021-11-26)
Re: Union C++ standard gah4@u.washington.edu (gah4) (2021-11-26)
Re: Union C++ standard david.brown@hesbynett.no (David Brown) (2021-11-27)
Re: Union C++ standard derek@NOSPAM-knosof.co.uk (Derek Jones) (2021-11-28)
Re: Union C++ standard david.brown@hesbynett.no (David Brown) (2021-11-28)
Re: Union C++ standard derek@NOSPAM-knosof.co.uk (Derek Jones) (2021-11-29)
Re: Union C++ standard 480-992-1380@kylheku.com (Kaz Kylheku) (2021-11-29)
Re: Union C++ standard david.brown@hesbynett.no (David Brown) (2021-11-29)
Re: Union C++ standard Keith.S.Thompson+u@gmail.com (Keith Thompson) (2021-11-29)
Re: Union C++ standard derek@NOSPAM-knosof.co.uk (Derek Jones) (2021-11-30)
[3 later articles]
| List of all articles for this month |
From: Derek Jones <derek@NOSPAM-knosof.co.uk>
Newsgroups: comp.compilers
Date: Sun, 28 Nov 2021 12:51:14 +0000
Organization: Compilers Central
References: 21-11-004 21-11-008
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="13223"; mail-complaints-to="abuse@iecc.com"
Keywords: C, standards
Posted-Date: 28 Nov 2021 12:13:12 EST
In-Reply-To: 21-11-008
Content-Language: en-US

David,


> In C, type-punning via unions is allowed (i.e., fully defined behaviour


That is not true. Writing into one member and then reading from
another member is undefined behavior.


There is a special dispensation for what is known as a
common initial sequence:
sentence 1029
http://c0x.shape-of-code.com/6.5.2.3.html


> in the standards), but not in C++ where the language is expected to
> enforce higher-level aspects of the data.


This is a meaningless statement.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.