It's not necessary, but often prevents compiler warnings of the nature 'object may not respond to selector blah'.
And using (sometype*) to cast pointers in c/c++/objc doesn't incur any overhead (ie: it doesn't generate code), it's really just a way to telling the compiler that you (think you) know what you're doing.
And using (sometype*) to cast pointers in c/c++/objc doesn't incur any overhead (ie: it doesn't generate code), it's really just a way to telling the compiler that you (think you) know what you're doing.
OK, fair enough. Well I haven't gone over the top with my streamlining, just when I felt nothing was added by casting. No compiler warnings yet, so looks like I'm doing OK.
I'd recommend caution here: "initWithBytes:length:" and "initWithBytes:size:" are not the same selector, and I'm not 100% sure how objc even handles different param types (eg: ints vs floats) and how this affects selector selection(!).
But feel free to experiment anyway!
But feel free to experiment anyway!
Yep, gotcha! Wikipedia had a really useful article on Objective-C, and there are quite a few other good tutorials on the net, so I spotted this potentially hazardous behaviour before I started hacking (thankfully).
Just sent my MaxGUI changes out for testing, so hopefully I'll have a pile of updates to checkout by the end of the week (that is, if my BETA testing team don't find anything to report). ;-)