Re: Codewarrior ->Xcode port
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:
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