This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/19973] New: gdb prints sizeof a char literal is 1 when the language is C
- From: "sadiq at sadiqpk dot org" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 20 Apr 2016 13:26:14 +0000
- Subject: [Bug gdb/19973] New: gdb prints sizeof a char literal is 1 when the language is C
- Auto-submitted: auto-generated
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.