• 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: Codewarrior ->Xcode port
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Codewarrior ->Xcode port


  • Subject: Re: Codewarrior ->Xcode port
  • From: Chris Espinosa <email@hidden>
  • Date: Tue, 10 May 2005 09:15:26 -0700


On May 10, 2005, at 8:38 AM, Chris Espinosa wrote:

invalid conversion from 'const unsigned char' to 'unsigned char'

initializing argument 1 of void RedAlert(unsigned char)


Is there a setting on the compiler to allow such things?  In this case it's calling a function RedAlert:


void RedAlert(Str255 message) {

}


like this:


RedAlert("\pThis isn't working");


I suspect you don't pass the -fpascal-strings flag:

file:///Developer/ADC Reference Library/documentation/DeveloperTools/gcc-4.0.0/gcc/Pascal-Strings.html

A Str255 is an unsigned char *, while a literal string is a char *.  gcc is telling you in its inimitable way that it's calling RedAlert with the literal string "backslash p t h i s space i s n apostrophe t space w o r k i n g".  RedAlert will read the slash as the length byte and produce somewhat unexpected results.


OK, I tried this in a sample and didn't get the results you did.  In a normal Carbon app, I got no error.  If I disabled Pascal strings, I got the fairly clear warnings

/Volumes/Local/Projects/Test/4050608/main.c:24:10: warning: unknown escape sequence '\p'
/Volumes/Local/Projects/Test/4050608/main.c:24: warning: pointer targets in passing argument 1 of 'RedAlert' differ in signedness

The above warning is actually about passing a const to a function that doesn't treat it as a const.  The compiler would say this if you were, for example, trying to assign to 'message' inside RedAlert.  But I couldn't reproduce this in my sample app.  Are you doing this in a library, or across compilation units, or in some other context?  

Chris
 _______________________________________________
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

References: 
 >Codewarrior ->Xcode port (From: Bob Sabiston <email@hidden>)
 >Re: Codewarrior ->Xcode port (From: Chris Espinosa <email@hidden>)

  • Prev by Date: Re: XCode/xcodebuild problems...
  • Next by Date: re: Creating Xcode templates
  • Previous by thread: Re: Codewarrior ->Xcode port
  • Next by thread: Re: Codewarrior ->Xcode port
  • Index(es):
    • Date
    • Thread