3 ms·
You're right -- the general rule is that ints and ptrs shouldn't be interchanged. However -- In this case, it's likely the number of integers required (control
by jwilliams 17y ago
You're right -- the general rule is that ints and ptrs shouldn't be interchanged.
However -- In this case, it's likely the number of integers required (controller ids, which I guess might be 1 to 4?) would fit in almost any ptr you can think of.
Conversions aren't guaranteed, but if you copy/pack it yourself there shouldn't be a problem -- e.g. do a memcpy of one byte.
More likely the author was pointing at the fact that this value was later 'free'd' by the event loop. Which is fairly nasty.
- grsxfcyt 17y agoThe general rule is that you shouldn't go free-ing memory you didn't allocate. I had one colleague who would insist on trying to free FILE* after he had closed the file.