3 ms·
In CL case the "is an error" wording generally covers all of C's "implementation-defined", "unspecified" and "undefined". And surprising amount of normal lookin
by dfox 8y ago
In CL case the "is an error" wording generally covers all of C's "implementation-defined", "unspecified" and "undefined". And surprising amount of normal looking constructs are in the implementation-defined category.
When you add type declarations and (optimize (safety 0)) into the mix you get similar scope of UB as in C (another thing is that in reality nobody actually writes code like that)
- fiddlerwoaroof 8y agoI’m thinking of things like it being UB to modify a reader literal because the reader is allowed to do things like tail sharing.
- dfox 8y agoI think that modifiing reader literal is an error mostly to allow implementations to store such pairs in read-only pages (eg. in .rodata section when you build standalone executables) and to allow simple implementation of CDR-coding for reader literals (dfsch has three distinct implementations of abstract <pair> class for exactly this reason and to be able to actually signal meaningful error condition when you violate this restriction).
- fiddlerwoaroof 8y agoBut it’s not an error: for some of these cases the standard doesn’t specify the consequences and most implementations don’t throw an error if you modify a reader literal, even if you end up modifying the interned list.
- dfox 8y ago"Is an error" is wording used by the standard for things that are left undefined. For things that should signal some kind of error condition the standard uses wording "an error is signalled", the set of such cases is surprisingly small.