On Mon, Feb 24, 2014 at 5:00 PM, Ingo Schwarze <schwa...@usta.de> wrote: ... > The above behaviour is required by POSIX: > > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html#tag_17_01_02_01 > > "Integer variables and constants, including the values of operands > and option-arguments, used by the standard utilities listed in > this volume of POSIX.1-2008 shall be implemented as equivalent > to the ISO C standard signed long data type; floating point shall > be implemented as equivalent to the ISO C standard double type. > Conversions between types shall be as described in the ISO C > standard. All variables shall be initialized to zero if they are > not otherwise assigned by the input to the application. ... > Our /bin/expr uses "int" to store integer numbers. > As long as we have sizeof(int) == sizeof(long) on all > architectures (hum... /me isn't a hardware hacker) > that's fine as well.
Our expr is broken then: on LP64 platforms (amd64, sparc64, mips64, etc) int is only 32bits while long is 64bits. (We have both kinds of platforms: country (ILP32) and western (LP64). ILP32 have 32bit types for int, long, and pointers, while LP64 have 32bit ints and 64bit longs and pointers.) Philip Guenther