• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: programming in C++ ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: programming in C++ ?
      • From: John Stiles <email@hidden>
    • Re: programming in C++ ?
      • From: Jiva DeVoe <email@hidden>
References: 
 >programming in C++ ? (From: "Cor" <email@hidden>)

  • Prev by Date: Re: insertText: without a NSWindow/NSView (or: Unicode input without NSView/Window)
  • Next by Date: Re: SliderText = NSSlider + NSTextField
  • Previous by thread: Re: programming in C++ ?
  • Next by thread: Re: programming in C++ ?
  • Index(es):
    • Date
    • Thread