[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: does lua_pushstring check stack overflow? (Lua 5.0.2)
- From: Dave Dodge <dododge@...>
- Date: Tue, 29 Nov 2005 17:40:59 -0500
On Tue, Nov 29, 2005 at 10:21:54AM +0100, Klaus Ripke wrote:
> The C language does define a lot of library functions and none
> checks bad pointers.
I wouldn't say "none". There are a few cases where passing a null
pointer does have defined behavior in the C API. The most obvious
example is free(NULL), which was originally undefined but considered
useful enough to add it as a safe operation for C89.
Now, if by "bad pointer" you also mean non-null bad pointers, then
indeed there are no checks for that sort of thing.
> but there is no way in C to check for a runaway pointer like a stack
> overflow.
In fact as far as standard C is concerned, the existence of a stack at
all is an implementation detail. Terms such as "stack" and "heap"
aren't even in the Standard. They just come from the most common ways
of implementing it.
-Dave Dodge