Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我使用非 ascii 字符来定义全局数组时,例如:
const char table[] = {[L'č'] = 'c', ...};
所以 C 处理情况,我在哪里更改语言环境,然后通过这些索引访问数组?这是如何编译的?因为'č'在不同的编码中具有不同的价值。
'č'
编译器应将源代码中的字符从源代码编码转换为在编译时选择的执行范围字符集。然后,这些值将是具有该编码中该字符的整数值的常量。调用setlocale()不会对值产生任何影响。
setlocale()