Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.compilers > #2758
| Path | csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end |
|---|---|
| From | Derek Jones <derek@NOSPAM-knosof.co.uk> |
| Newsgroups | comp.compilers |
| Subject | Re: Union C++ standard |
| Date | Mon, 29 Nov 2021 00:09:39 +0000 |
| Organization | Compilers Central |
| Lines | 31 |
| Sender | news@iecc.com |
| Approved | comp.compilers@iecc.com |
| Message-ID | <21-11-011@comp.compilers> (permalink) |
| References | <21-11-004@comp.compilers> <21-11-008@comp.compilers> <21-11-009@comp.compilers> <21-11-010@comp.compilers> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="99482"; mail-complaints-to="abuse@iecc.com" |
| Keywords | C, standards |
| Posted-Date | 28 Nov 2021 22:18:40 EST |
| X-submission-address | compilers@iecc.com |
| X-moderator-address | compilers-request@iecc.com |
| X-FAQ-and-archives | http://compilers.iecc.com |
| In-Reply-To | <21-11-010@comp.compilers> |
| Content-Language | en-US |
| Xref | csiph.com comp.compilers:2758 |
Show key headers only | View raw
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. > > No, it is correct. It would be helpful if you looked at the full You have misunderstood the C conformance model, which revolves around the use of "shall" and "shall not", and the kind of section in which they appear (e.g., Constraints). See: http://c0x.shape-of-code.com/4..html For a longer discussion see: http://knosof.co.uk/cbook/ > """ > If the member used to read the contents of a union object is not the > same as the member last used to store a value in the object, the > appropriate part of the object representation of the value is > reinterpreted as an object representation in the new type as described > in 6.2.6 (a process sometimes called "type punning"). This might be a > trap representation. > """ > > These quotations are from C18 (draft N2346), which is the current C > standard (until C23 is finalised). They have not changed since C99, This footnote was added in response to this DR (so it must have come after C99): http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_283.htm
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
Union C++ standard Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2021-11-25 11:11 +0100
Re: Union C++ standard Kaz Kylheku <480-992-1380@kylheku.com> - 2021-11-26 18:06 +0000
Re: Union C++ standard gah4 <gah4@u.washington.edu> - 2021-11-26 12:16 -0800
Re: Union C++ standard David Brown <david.brown@hesbynett.no> - 2021-11-27 16:59 +0100
Re: Union C++ standard Derek Jones <derek@NOSPAM-knosof.co.uk> - 2021-11-28 12:51 +0000
Re: Union C++ standard David Brown <david.brown@hesbynett.no> - 2021-11-28 19:00 +0100
Re: Union C++ standard Derek Jones <derek@NOSPAM-knosof.co.uk> - 2021-11-29 00:09 +0000
Re: Union C++ standard David Brown <david.brown@hesbynett.no> - 2021-11-29 21:00 +0100
Re: Union C++ standard Derek Jones <derek@NOSPAM-knosof.co.uk> - 2021-11-30 00:46 +0000
Re: Union C++ standard George Neuner <gneuner2@comcast.net> - 2021-11-30 17:18 -0500
Re: Union C++ standard terminology Derek Jones <derek@knosof.co.uk> - 2021-12-01 13:35 +0000
Re: Union C++ standard David Brown <david.brown@hesbynett.no> - 2021-11-30 23:24 +0100
Re: Union C++ standard Kaz Kylheku <480-992-1380@kylheku.com> - 2021-11-29 16:39 +0000
Re: Union C++ standard Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-11-29 14:32 -0800
csiph-web