Re: PREfast: Different outcome if compiled with or without?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ray Trent (ratrent_at_nospam.nospam)
Date: 02/22/05


Date: Tue, 22 Feb 2005 13:52:33 -0800

Hmmm. Don't see anything obvious unless it's a twitchy difference
between the prefast compiler and the standard one (they aren't exactly
the same compiler IIRC).

Technically speaking, it's not legal to call a macro function and to
fail to pass one of the parameters. Since comments are typically
stripped before macros are expanded, your declaration of ARCH_SIGNALDECL
(as, effectively, "ARCH_LINUX_WIN(,__cdecl)") may have undefined
behavior. The spec is a bit unclear on this point, though, so I could be
misreading it... Also, this may not apply to your actual situation...

Spiro Trikaliotis wrote:
> Hello,
>
> Ray Trent <ratrent@nospam.nospam> schrieb:
>
>
>>What's the error message?
>
>
> A good question. I totally forgot to mention that:
>
> main.c(19) : error C2440: 'function' : cannot convert from 'void
> (__stdcall *)(int)' to 'void (__cdecl *)(int)'
>
> I set up a small sample on
> http://www.trikaliotis.net/download/ddk-prob/prefast-problem.zip
> that shows the behaviour.
>
> Compiling with
> build -cefZ
> , it compiles perfectly.
>
> Running
> prefast build -cefZ
> , you get the above error message.
>
> Replacing
>
> #define ARCH_SIGNALDECL ARCH_LINUX_WINDOWS(__cdecl, __cdecl)
>
> in arch.h, the problem is gone, too.
>
> Does prefast make the compiler "forget" that it is running in WIN32?
> (just kidding)
>
> Regards,
> Spiro.
>

-- 
../ray\..


Relevant Pages

  • Re: Error a: _mayn.c:12 illegal return type, found int expected void
    ... > a given compiler writer allows or forbids is ... The error message I recieved was in plain english ... >Do you, Jacob, perhaps have a belief that all C programers ... the purpose of lint is to provide error messages. ...
    (comp.compilers.lcc)
  • understanding segmentation faults
    ... Is "segmentation fault" an error message that is issued by the operating ... not a problem that the compiler vendors can easily solve. ... technical terminology an "array section"?). ...
    (comp.lang.fortran)
  • Re: xPC target w/ Matlab 2009a - unable to build model
    ... The error message makes me believe that there is some compiler environment/path issue on the PC you are working on. ... When you do a mex -setup are you able to see the Watcom 1.7 compiler? ... Setting environment for using Microsoft Visual Studio 2008 ...
    (comp.soft-sys.matlab)
  • Re: operator function
    ... >> of them have anything to do with what the error message seems ... Setting (int h, int m, int s, int TT) ... Now the compiler knows, that it is safe to use that function on a const ... >> operator returns a Setting object. ...
    (alt.comp.lang.learn.c-cpp)
  • c89 problem w/ irrhfsu
    ... i've got a lot of experience setting up and configuring OMVS but not ... by means of the c89 compiler, inside the OMVS environment, (this is ... and i received the following error message: ...
    (bit.listserv.ibm-main)