是C ++ ASCII感知的吗?
一个同事告诉我:
C ++不支持ASCII.
C++ is not ASCII-aware.
C ++程序的源字符集是实现定义的,所以我的同事在多大程度上不正确?
The source character set of a C++ program is implementation-defined, so to what extent is my colleague incorrect?
当c ++编译器将数字48
值链接到'0'
时,需要知道ASCII.所以是的,它必须能够识别ASCII.
The c++ compiler needs to be ASCII aware when it links the numeric 48
value to '0'
. So yes, it needs to be ASCII-aware.
但是它总是需要吗?假设您使用 EBCDIC ('0' => 240
).然后,编译器可能不在乎ASCII.也许那就是你同事的意思.
But does it always needs to? Imagine you work with EBCDIC ('0' => 240
). Then the compiler probably doesn't care about ASCII. Maybe that's what you colleague meant.
C ++并不真正关心ASCII.这是一个实现细节.
C++, generally speaking, does not really care about ASCII. It is an implementation detail.