N3881: Fixing the specification of universal-character-names -- David Krauss

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3881

Date: 2014-01-03

Fixing the specification of universal-character-names

by David Krauss

Excerpt:

There are two main problems with the current specification of UCNs, which remains essentially the same as initially standardized.

  1. Undefined behavior is an undesirable kind of specification, because it technically allows the implementation to quietly produce a defective executable file. There is consensus that errors in preprocessor usage should not have runtime consequences. There is even a CERT security advisory about UCNs causing undefined behavior. N3801 "Removing Undefined Behavior from the Preprocessor" directly addresses this by recommending to convert undefined behavior specifications to ill-formedness.
  2. There are corner cases which are not specified as undefined behavior. These may be welldefined and misinterpreted, or ill-formed yet undiagnosed, by popular implementations, or simply excessively restrictive. Underspecified cases undermine the effect of N3801 by remaining wrongly defined.

The present paper will review several corner cases, considering the natural response of models A,
B, and C, and the actual behavior of GCC and Clang. This leads to a specification permitting
implementation flexibility without ambiguity, and bringing existing compilers into conformance.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.