[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Must a userdata void* point to a valid memory location?
- From: lua+Steven.Murdoch@...
- Date: Mon, 25 Nov 2002 11:57:02 +0000
>From my understanding of the Lua spec, from the perspective of the C program
that Lua is embedded in, userdata items are of type void*.
In my application it would be more convenient if the userdata was an int,
rather than the address of a memory location. Clearly my C program will never
attempt to dereference the int as if it was a void*. However could the current
lua interpreter, or a lua program running in the interpreter, ever perform an
action (such as dereference, free, realloc, etc...) on a userdata with the
expectation that it is a pointer to a valid memory location?
Secondly, if it is safe to provide userdata values which are not pointers to a
valid area of memory, then is this safety guaranteed by the specification, so
I can likely expect this to work with future versions.