Re: CW10 assignment, void*, func ptr warnings...
- From: larry@xxxxxxxxxx
- Date: 14 Nov 2005 20:11:08 -0800
> Starting my CW9.4 to CW10 migration. So far I am unsuccessful in
> compiling the simplest of projects. Sigh.
Wow. I had only one or two minor issues porting my project of over 700
files.
>
> 1) Warning : possible unwanted assignment
> FileUtils.cc line 768 if (filePathStart && (len =
> strlen(filePathStart)))
>
> the old trick of parenthesizing the expr no longer seems to work?
Just my personal opinion here, but wish it had never worked. LOL
Nesting statements like this saves a line or two of code, but makes
code harder to read in the process. I'd just have:
int len = ( filePathStart ? strlen(filePathStart) : 0 );
if ( len )
....
In any case, your code compiles just fine in my application, so I don't
know why you're getting a warning.
> 2) Warning : illegal explicit conversion from 'bool (*)(bool)' to 'void
> *'
>
> have some code that was "forced" to move to a void* for a func ptr,
> and the compiler wont tolerate this? It also emits a similar warning
> when going from the void* back to a func ptr cast. Why?
>
> 3) errors about func signatures; eg, when calling NewUserItemUPP(), I
> get errors about the func ptr:
>
> Error : function call 'NewUserItemUPP({lval} pascal void
> (OpaqueDialogPtr *, short))' does not match
> 'NewUserItemUPP(pascal extern "C" void (*)(OpaqueDialogPtr *, short))'
>
> Must I now declare them with extern "C" ??
>
> Gee. These kinds of issues are really not helpful when one has real
> problems to solve..
I don't know why the extern "C" part is in there. I don't see this when
I use UPPs. The following compiles just fine for me:
static pascal
void f( DialogRef theDialog, DialogItemIndex itemNo )
{
}
void RunTest()
{
UserItemUPP u = NewUserItemUPP( f );
}
Out of curiosity, do you really need to stick with the Dialog Manager?
Larry
.
- Follow-Ups:
- References:
- Prev by Date: Re: CW10 assignment, void*, func ptr warnings...
- Next by Date: CodeWarrior 10.1 for Intel/Rosetta Debugging?
- Previous by thread: Re: CW10 assignment, void*, func ptr warnings...
- Next by thread: Re: CW10 assignment, void*, func ptr warnings...
- Index(es):
Relevant Pages
|