How can I compute the range of signed and unsigned types

beowulf at hoolan.org beowulf at hoolan.org
Wed Apr 18 06:59:08 PDT 2001


The most effective method I use frequently:

% gdb
GNU gdb 4.17.0.11 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