Re: VC++ compiler warnings

From: Dirk Bellemans <Dirk.Bellemans_at_skynet.belgium>
Date: Mon, 16 Aug 1999 21:50:30 +0200
Message-ID: <7panql$pc7$>

Walter Boggs wrote in message <7ov18g$ert$>...
>I have successfully converted all the forms and have recompiled the old
>DOS C code under VC++ 5, so now we have a nice DLL. It even executes
>- I can step through it in the VC debugger. However, I get some compiler
>warnings that I don't understand:
>warning C4047: 'function' : 'const unsigned long *' differs in levels of
>indirection from 'const unsigned long '
>warning C4024: 'sqlcx2t' : different types for formal and actual
>parameter 2
>This pair of messages appears wherever sqlcx2t gets called. For the
>uninitiated, this call is inserted by the Pro*C precompiler, so I don't
>seem to have much control over it.

The first warning says that your source code is trying to use a (const unsigned) pointer to a long as if it were a (const unsigned) long. If you try that for your school assignment, you'll flunk ;-) However, it does work in some cases. The decent thing would be to use a cast...

The second warning says something similar: your function prototype says it expects a parameter of type A, but you are passing a parameter of type B. Now they could well be exactly the same (like "long" and "int" on a W32 system), hence the warning instead of an error.

So, either you are passing parameters of the wrong type, or Pro*C has sloppy routines. In the first case, you're lucky your code is working without crashing and may give unpredictable results in a release build. In the second case, the easiest thing is to try to turn off the warnings for the code you did not write (#pragma warning ...).

Dirk Bellemans
Modify email address to reply (use .be instead of .belgium)
Received on Mon Aug 16 1999 - 21:50:30 CEST

Original text of this message