Non null-terminated string compiler option for gcc
问题 Update turns out this is just another case of "c++ is not c blues" What I want const char hex[16] = "0123456789ABCDEF"; the only thing that works char hex[16] = "0123456789ABCDE"; hex[15] = "F"; are there any compiler options or something I can do to make strings not null terminated in the gcc compiler. so that I can make a(n) constant array 回答1: No need for a compiler option, it's already non-NUL terminated. The standard says a NUL should only be added if it can fit, otherwise it would be an