Re: programming in C++ ?
Re: programming in C++ ?
- Subject: Re: programming in C++ ?
- From: Thomas Engelmeier <email@hidden>
- Date: Thu, 31 Jan 2008 09:22:34 +0100
On 31.01.2008, at 00:17, Cor wrote:
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++ ;-).
Regards,
Tom_E
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden