• 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: multi-character character constant and CFString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multi-character character constant and CFString


  • Subject: Re: multi-character character constant and CFString
  • From: John Stiles <email@hidden>
  • Date: Tue, 26 Jul 2005 10:40:52 -0700

Because some developer who worked on GCC thought that a two-character constant seemed like an unusual thing to do. There is nothing wrong with the code. GCC has lots of warnings that aren't necessarily a sign of broken code.


On Jul 26, 2005, at 12:12 AM, Julien Palmas wrote:

If there is nothing wrong in the code, then why would I get a warning with gcc ?
I tend to believe that a warning is usually not useless ...


On Jul 26, 2005, at 12:58 PM, John Stiles wrote:


I would disable that warning. There is absolutely nothing wrong with the original code.
Alternatively, you could wrap the ((a << 8) | b) trick with a macro that made it look nicer.



On Jul 25, 2005, at 7:31 PM, Julien Palmas wrote:



I am porting a Codewarrior project to XCode and need some advices about how to do things correctly

I have this function :

TCProfileTextType(
const std::string& inText,
unsigned long inTagSignature,
const short inLangCode = 'ja',
const short inRegionCode = 'JP');


I get no warnings whatsoever in Codewarrior, but compiling the same source file with gcc 4.0 raises this :
warning : multi-character character constant


I would like to get rid of this warning and tried this :

#include <limits.h>

TCProfileTextType(
const std::string& inText,
unsigned long inTagSignature,
const short inLangCode = ('j' << CHAR_BIT) | 'a',
const short inRegionCode = ('J' << CHAR_BIT) | 'P');


Works, but I don't really like it ....

I read in the CodeWarrior / Xcode porting guide that CFString should be used for this kind of porting problem.

Could anybody tell me how to use CFString in such a situation ?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40blizzard.com


This email sent to email@hidden







_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40blizzard.com


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >multi-character character constant and CFString (From: Julien Palmas <email@hidden>)
 >Re: multi-character character constant and CFString (From: John Stiles <email@hidden>)
 >Re: multi-character character constant and CFString (From: Julien Palmas <email@hidden>)

  • Prev by Date: Style/Design question - when and how to authorise
  • Next by Date: Initializing views with models
  • Previous by thread: Re: multi-character character constant and CFString
  • Next by thread: Is this a bug in setKeys:triggerChangeNotificationForDependentKey:?
  • Index(es):
    • Date
    • Thread