Re: Testing atoms if pointer
- Posted by mattlewis (admin) Aug 16, 2010
- 1275 views
This is a relative simple example. But there are some functions in the Iup library in which case I am not sure if I always can use C_POINTER. So I wondered if there would be a simple check to see if an arguement in the sequence is a pointer or a value.
OK, I see what you're doing. The real issue is the expected size of the argument. In a 32-bit system*, a C int, pointer or long will all be 4 bytes long. For passing parameters, the sign doesn't really matter. You need to be careful if the arguments take shorts, chars (NB not pointers to char), floats or doubles.
I'm not familiar with IUP, but I suspect that most of them can be treated like C_POINTERs
Matt
* I have a mostly working 64-bit implementation of euphoria, and for that C_INT will be a different size than C_LONG and C_POINTER.