[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Simple AI Scripting, Help Me!
- From: Reuben Thomas <rrt@...>
- Date: Wed, 10 Dec 2003 12:24:25 +0100 (CET)
> Not exactly. In a worst case cenario, the program may be using >2^31
> bytes of memory; when it computes the threshold it will double that
> quantity. That will generate an overflow. Actually, that can happens
> even with a long, if the long is only 32 bits. The best we can do
> is the best we can do...
The paranoid programmer would presumably check for this sort of thing, and
latch the maximum threshold to ULONG_MAX (assuming you're using unsigned
long), rather than just doubling and hoping.
--
http://www.mupsych.org/~rrt/
Si hoc legere scis nimium eruditionis habes (Anon)