[Bug c/116082] -Wunterminated-string-initialization should not warn about strings that end with "\0" but should warn still for -Wc++-compat
alx at kernel dot org
gcc-bugzilla@gcc.gnu.org
Thu Jul 25 09:53:08 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116082
--- Comment #2 from Alejandro Colomar <alx at kernel dot org> ---
I agree with martin.
And what if the '\0' is in the middle of the literal?
char x[4] = "a\0b";
char x[3] = "a\0b";
char y[2] = "a\0b";
I'd keep it simple, and assume the \0s in the middle of a string literal are
not our business as far as this diagnostic is concerned. If we cannot write
the implicit null byte, diagnose.
More information about the Gcc-bugs
mailing list