For QTKit I seem te need to write in Objective-C.
For the IOKit I need to write in C++.
I'm a experienced C++ programmer, so I prefer to program in C++, but
how do I interface to QTKit?
I did read something about .mm files.
If I understand correctly then .mm files may contain Object-C and C+
+ mix.
But if this is so, why are not all files .mm (why are .m files
needed?).
[...]
Does it hurt when I only use .mm files?
Yes. Significantly higher compile times and as others stated,
different parsing, in this case: stronger type checking.
While the Obj-C compiler does not complain in a number of places where
you assign the 'id' you get back from [anArray objectAtIndex:i] to
e.g. an NSString *, the C++ compiler does.
So basically, to silence the compiler, quite some casts are required,
which is IMHO fundamentally against the spirit of C++.
OTOH, for many Cocoa runtime errors you get at least a compiler
warning, so you probably don't want noise on your compiler warnings.
Another sidenote: IOKit uses AFAIK an exception- and template-less
subset of C++, so the mix with Objective-C is far smoother.
(IMO, the maior PITA for CORRECT code are the different exception
handling mechanisms).
Does it makes sense to write Cocoa applications in C++?
No. But it makes partially sense to write it in Objective-C++ ;-).