How can I compute the range of signed and unsigned types

beowulf at beowulf at
Wed Apr 18 06:59:08 PDT 2001

The most effective method I use frequently:

% gdb
GNU gdb with Linux support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux".
(gdb) p sizeof(char)
$1 = 1
(gdb) p sizeof(int)
$2 = 4
(gdb) p sizeof(long)
$3 = 4
(gdb) p sizeof(long long)
$4 = 8
(gdb) p sizeof(float)
$5 = 4
(gdb) p sizeof(double)
$6 = 8
(gdb) p sizeof(long double)
$7 = 10

More information about the Beowulf mailing list