Just a sample of the Echomail archive
COMPLANC:
[ << oldest | < older | list | newer > | newest >> ]
|  Message 243,004 of 243,097  |
|  James Russell Kuyper Jr. to Andrey Tarasevich  |
|  Re: UB or not UB? was: On Undefined Beha  |
|  13 Jan 26 22:10:27  |
 From: jameskuyper@alumni.caltech.edu On 2026-01-13 11:11, Andrey Tarasevich wrote: > On Mon 1/12/2026 9:36 AM, Michael S wrote: >> But I was interested in the "opinion" of C Standard rather than of gcc >> compiler. >> Is it full nasal UB or merely "implementation-defined behavior"? > > ... And, of course, it is as > "implementation-defined" as any other UB in a sense that the standard > permits implementations to _extend_ the language in any way they please, > as long as they don't forget to issue diagnostics when diagnostics are > required (by the standard). "implementation defined" is a term defined by the standard. It does not carry it's ordinary English definition "defined by the implementation". Instead, it means "unspecified behavior where each implementation documents how the choice is made". Unless the standard explicity says that the behavior is implementation-defined, the fact that any particular implementation chooses to define it is irrelevant. >>> Perhaps there's a switch in GCC that would outlaw the classic "struct >>> hack"... But in any case, it is not prohibited by default for >>> compatibility with pre-C99 code. The struct hack has always technically had undefined behavior, but in practice almost all C90 implementations allowed it to work. In C99 flexible array members were added, which allows the struct hack to work with fully-defined behavior using slightly different syntax. The struct hack itself is still just as undefined as it ever was, and because of the invention of flexible array members, is increasingly likely to not be supported. --- SoupGate-Win32 v1.05 * Origin: you cannot sedate... all the things you hate (1:229/2) |
[ << oldest | < older | list | newer > | newest >> ]
(c) 1994, bbs@darkrealms.ca