• 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: Objective-C or C++ or something...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C or C++ or something...


  • Subject: Re: Objective-C or C++ or something...
  • From: Óscar Morales Vivó <email@hidden>
  • Date: Thu, 7 Aug 2003 23:10:52 +0200

On Thursday, 7 August 2003, at 22:25 PM, Karl Kuehn wrote:

Strict C and C++ do not allow this, ObjC and ObjC++ do allow this, so all you have to do is change file extension over and you will be golden. You don't have to use anything in the Obj side of the language. C++ files named as ObjC++ files will compile just fine (there may be something in the more advanced structures where I am wrong... but for most of us...).


Uh, sorry to be picky, but the C++ standard AFAIK sure tells you can declare variables nearly anywhere.

Anyway, if you want to use some C++-isms in your code (like references, sometimes useful) just use the .mm suffix for all code files that use them (including those that import headers with C++-isms.

However, if you use GCC 3.x you'll probably be able to use most of C99, including declaring variables anywhere.

Hope that helps.


/*
Oscar Morales Vivs

Eternal Computer Science Student. Master of C++ Templates. Cocoa Nut. Computer Graphics Scientiam Lumina. UI Guru in Training. Dabbler in all things CS and most which are not.

Web stuff: http://homepage.mac.com/oscarmv/index.html
*/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Objective-C or C++ or something... (From: Karl Kuehn <email@hidden>)

  • Prev by Date: Re: catch key event
  • Next by Date: Re: Objective-C or C++ or something...
  • Previous by thread: Re: Objective-C or C++ or something...
  • Next by thread: Re: Objective-C or C++ or something...
  • Index(es):
    • Date
    • Thread