gpt4 book ai didi

c++ - 有效的 header 名称

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:11:30 26 4
gpt4 key购买 nike

我无法正确理解它们在以下文章中的含义:

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.

我在所有 C 和 C++ 标准中发现了以下语句:

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

! " # % & ' ( ) * + , — . / :
; < = > ? [ \ ] ^ _ { | } ~

例如,我什至在 C89/C90 中也能看到下划线和数字。

最佳答案

指的是这个:

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)

这是C99版本:

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.

关于c++ - 有效的 header 名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15731605/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com