Mail Archives: djgpp/1999/08/31/15:21:04
On Mon, 30 Aug 1999, Dave Bird wrote:
> > void validate_or_die (void *ptr)
> > {
> > if ( (unsigned)p < 0x1000)
> > abort ();
> > }
>
> Sounds possible... I'd prefer to log or report rather than abort,
That's up to you, but `abort' has an advantage of producing a
traceback, which shows you the entire sequence of function calls that
led to the problem; whereas in a log message it is not trivial to
print enough information to let you know who's the villain.
Anyway, why let a program that dereferences NULL run? ;-)
> and is there an upper limit??
The upper limit is the data segment limit. But you don't have to
check that, since any protected-mode environment, including Windows,
catches those cases and crashes your program with a GPF.
- Raw text -