Re: Euphoria question routine_id
- Posted by mattlewis (admin) Oct 02, 2008
- 931 views
I have a problem that I can not find a solution to. I have a rotine that receives a parameter as a number. I need to know if it is a just a low number or if it is a routine_id.
If the call_back() returned a -1 instead of reporting an error when it contained a bad routine_id that would be fine.
It seems that this is a inconsistency why shouldn't call_back() do the same as routine_id() ?
There is no inherent way to determine this. A routine id is just a number. Even if it's a valid routine id, does not mean that the code that is using the number means for it to be a routine id. The only way, it seems is to pass some additional metadata to indicate that it's meant to be a routine id.
I'd actually say that a call back should be zero if it's invalid, since it's really a pointer, and the null pointer is a pretty well known thing. But that's a good idea.
Matt