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]

c++/2059: sizeof should have unsigned type in print expressions


>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:


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