This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
c++/2059: sizeof should have unsigned type in print expressions
- From: pr2345 at gmail dot com
- To: gdb-gnats at sources dot redhat dot com
- Date: 31 Dec 2005 17:21:35 -0000
- Subject: c++/2059: sizeof should have unsigned type in print expressions
- Reply-to: pr2345 at gmail dot com
>Number: 2059
>Category: c++
>Synopsis: sizeof should have unsigned type in print expressions
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Dec 31 17:28:01 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Patrick Rabau
>Release: unknown-1.0
>Organization:
>Environment:
>Description:
According to both the C and C++ standards, sizeof(...) has type size_t, which is supposed to be an unsigned type (typically unsigned int or unsigned long). But in expressions evaluated by print, gdb seems to consider sizeof as having a signed type instead.
>How-To-Repeat:
(gdb) print -4u
$1 = 4294967292
(gdb) print -sizeof(int)
$2 = -4
The two prints should give the same result.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: