Re: C++ compiler isn't being used
Re: C++ compiler isn't being used
- Subject: Re: C++ compiler isn't being used
- From: Jens Alfke <email@hidden>
- Date: Wed, 24 Aug 2011 14:09:00 -0700
On Aug 24, 2011, at 1:29 PM, Steve Mills wrote: I'm on my way to learning Objective-C[++] and wondered why all the examples were using the archaic C rule of requiring the "struct" keyword before variable declarations:
struct car { int year; };
Actually I hardly ever see that style used, since having to say ‘struct car’ everywhere is so annoying. It’s usually typedef struct { … } car;
I’m not sure why setting that compiler flag didn’t help, but I think you’re better off using the .mm file extension instead. It makes it more obvious that the source file contains C++ syntax, for example if you ever reused that file in another project or mailed it to someone else.
The drawback is that enabling C++ slows the compiler down a lot, and makes it use more RAM. It may not make a difference in small projects, but in big apps you’ll certainly notice. (At my last job I had to install 16GB of RAM to get decent turnaround time for builds, and “decent” still meant 30 seconds to rebuild after making a trivial change. But that was a rather huge app.)
—Jens |
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden