5

I can't understand correctly what does they mean in the following article:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1566.htm

It is interesting to note that C89 explicitly allowed only letters in header and include file names. C++ added underscores, and C99 added digits. Probably both standards should allow both.

I found the following statements in all C and C++ standards:

ISO/IEC 9899:1990

6.1.7 Header names
Syntax
1 header-name:
< h-char-sequence >
" q-char-sequence "
h-char-sequence:
h-char
h-char-sequence h-char
h-char:
any member of the source character set except
the new-line character and >
q-char-sequence:
q-char
q-char-sequence q-char
q-char:
any member of the source character set except
the new-line character and "

ISO/IEC 9899:1990

5.2.1 Character sets
...
Both the basic source and basic execution character sets shall have the following
members: the 26 uppercase letters of the Latin alphabet
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z
the 26 lowercase letters of the Latin alphabet
a b c d e f g h i j k l m
n o p q r s t u v w x y z
the 10 decimal digits
0 1 2 3 4 5 6 7 8 9
the following 29 graphic characters
! " # % & ' ( ) * + , — . / :
; < = > ? [ \ ] ^ _ { | } ~

For example, i see underscore and digits even in C89 / C90.

asked Mar 31, 2013 at 16:24
3
  • What is your question ? Commented Mar 31, 2013 at 16:25
  • 3
    @Synxis Why in the article author said that digits were only added in C99 and underscore character in C++, while i see it even in C89 / C90. Commented Mar 31, 2013 at 16:26
  • 2
    The problem the author sees is that the new standards have added headers like iso646.h and type_traits even though the C89 preprocessor isn't formally required to work with those names. Commented Mar 31, 2013 at 16:55

1 Answer 1

4

It's referring to this:

There shall be an implementation-defined mapping between the delimited sequence and the external source file name. The implementation shall provide unique mappings for sequences consisting of one or more letters (as defined in 2ドル.2.1) followed by a period (.) and a single letter. The implementation may ignore the distinctions of alphabetical case and restrict the mapping to six significant characters before the period.

(C89)

This is the C99 version:

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

answered Mar 31, 2013 at 16:41
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot! So, implementation can fail to compile or incorrectly compile code with #include "file_1.h" and #include "file_2.h" in C89 / C90, right?
@NikitaTrophimov - it would seem so. It seems a bit contradictory though.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.