lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Twas brillig at 14:05:46 09.03.2010 UTC-08 when pablo@trickplay.com did gyre and gimble:

 PP> On this particular platform, RAND_MAX is bigger than a regular
 PP> int. Unless the result of rand() is cast to an unsigned int, it can
 PP> overflow and return negative numbers.

Uhm?

$ cat a.c
#include <stdlib.h>
#include <stdio.h>

int main()
{
  printf("%lld\n", (long long)RAND_MAX);
  return 0;
}
$ mipsel-ip-linux-gnu-gcc -o a a.c
$ rsync a n516:
$ ssh n516
# ./a
2147483647
# uname -a
Linux ip 2.6.29-n516 #1 Sun Dec 20 19:19:46 UTC 2009 mips GNU/Linux
#

-- 
  http://fossarchy.blogspot.com/

Attachment: pgpzYAFAmsZrT.pgp
Description: PGP signature