Defect Report #302

Previous Defect Report < - > Next Defect Report


Submitter: Clark Nelson
Submission Date: 2004-10-26
Source: WG21
Reference Document: ISO/IEC WG14 N1068
Version: 1.1
Date: 2006-03-05
Subject: 6.10.2p5: Adding underscore to portable include file name character set

Summary

In analyzing the differences in this paragraph between C99 and C++, I discovered that C89 admitted only letters in include file names with guaranteed unique mappings. C99 later added digits, while C++ independently added underscores. I personally don't recall any discussion or rationale behind either decision. It's clear that simply synchronizing C++ to C99 would be a technical change, and could (from a pedantic perspective) invalidate some existing code. The only way to synchronize the two standards without invalidating any existing code would be to allow underscores and digits in both standards. This may be considered a good thing in any event.

Note that in my proposed change the terms of reference have changed slightly. That's because, in the C++ standard, for good or ill, the terms letter and digit aren't defined in the (earlier) section describing the character set, as they are in C99 (whereas in C89, the terms appeared there without being definitions). In C++, letter is defined in the (later) library section, and digit is defined only as a non-terminal. It would of course be possible to rearrange things in the C++ standard to more closely match the C standard, but synchronizing things in this way would be much easier. And again, using the non-terminal symbols in this context may be considered an improvement in itself.

Suggested Technical Corrigendum

Change 6.10.2p5:

The implementation shall provide unique mappings for sequences consisting of one or more letters or digits (as defined in 5.2.1) nondigits or digits (6.4.2.1) followed by a period (.) and a single letter nondigit. The first character shall be a letter not be a digit. The implementation may ignore the distinctions of alphabetical case and restrict the mapping to eight significant characters before the period.


Technical Corrigendum

Change 6.10.2p5:

The implementation shall provide unique mappings for sequences consisting of one or more letters or digits (as defined in 5.2.1) nondigits or digits (6.4.2.1) followed by a period (.) and a single letter nondigit. The first character shall be a letter not be a digit. The implementation may ignore the distinctions of alphabetical case and restrict the mapping to eight significant characters before the period.


Previous Defect Report < - > Next Defect Report