Re: CW10 assignment, void*, func ptr warnings...



> 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

.



Relevant Pages

  • Re: Calling a managed function from native code
    ... running on top of the CLR but which is isn't garbage collected. ... compiles to IL which is JIT compiled and runs on top of the CLR. ... void test() { ... You can't do that, String is not disposable, it doesn't have a destructor, it doesn't have a Dispose method. ...
    (microsoft.public.dotnet.languages.vc)
  • (no subject)
    ... your module compiles fine on my box using this method ... > I have tried to compile the hello.c module under kernel 2.6.3. ... > int initial_module (void) ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Linux compiling
    ... For a start, void main has *never* been correct and as Jack has said, it ... but what they hey, it compiles doens't it!" ... a warning - so from slightly broken to completely broken happened. ... It is a biggy and to ...
    (alt.comp.lang.learn.c-cpp)
  • Re: why does it crash?
    ... Could you be more specific at which line it crashes, ... vectorCities; ... > this program compiles, but crashes when run. ... > void output(); ...
    (comp.lang.cpp)
  • Re: vulnerabilities
    ... Even if it compiles, ... >void memset ... I guess C++ allows using the memset ... Dan Pop ...
    (comp.lang.c)