print char and signed char equally
xparmenides <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
According the manual, " Strings are identified as arrays of char values
without specified signedness. Arrays of either signed char or unsigned
char get printed as arrays of 1 byte sized integers. -fsigned-char or
-funsigned-char gcc options have no effect as gdb defines literal string
type "char" as char without a sign. For program code
char var0[] = "A";
signed char var1[] = "A";
You get during debugging
(gdb) print var0
$1 = "A"
(gdb) print var1
$2 = {65 'A', 0 '\0'}
"
But, I got a different result:
(gdb) l
1 #include <stdio.h>
2
3 int main(){
4 char var0[] = "A";
5 signed char var1[] = "A";
6 return 0;
7 }
(gdb) print var0
$3 = "A"
(gdb) print var1
$4 = "A"
It seems that print command displays a char the same as a signed char. I
think the mannual has a bug.