strcmp in gdb giving odd results
问题 In GDB (gnu v 7.1-ubuntu) I am getting really weird results when I try to use strcmp to determine if two strings are equal. p strcmp("hello","hello") is giving me the result -145947168 . Everything I try with strcmp or strncmp is returning -145947168 in gdb. What am I doing wrong? EDIT (thanks to Carl for the pointer to a related answer in the comments): See the answer to this question: How to evaluate functions in GDB? Apparently sometimes the compiler optimizes out functions called from