This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/19973] New: gdb prints sizeof a char literal is 1 when the language is C


https://sourceware.org/bugzilla/show_bug.cgi?id=19973

            Bug ID: 19973
           Summary: gdb prints sizeof a char literal is 1 when the
                    language is C
           Product: gdb
           Version: 7.10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: sadiq at sadiqpk dot org
  Target Milestone: ---

In C language, the size of a char literal is the size of an int. But in gdb it
prints as 1, which is the size of a char literal in c++.

(gdb) set language c
(gdb) show language
The current source language is "c".
(gdb) p sizeof ('a')
$1 = 1
(gdb) p sizeof ((int) 'a')
$2 = 4
(gdb) p sizeof ('a') == sizeof (5)
$3 = 0
(gdb) p sizeof ((int) 'a') == sizeof (5)
$4 = 1
(gdb)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]