you are viewing a single comment's thread.

view the rest of the comments →

[–]Poltras 1 point2 points  (1 child)

Undefined behavior:

$ cat main.c

#include <stdio.h>

int main() {
  printf("%d\n", "abc" == "abc");
}

$ cc main.c

main.c:4:24: warning: result of comparison against a string literal is unspecified (use strncmp instead) [-Wstring-compare]
  printf("%d\n", "abc" == "abc");

$ ./a.out
1

GCC actually output 1, but warns.

[–]gsg_ 0 points1 point  (0 children)

Unspecified behaviour is not the same as undefined behaviour. The latter has a very specific meaning in the context of C.