VS.NET compiler options - check placeholder, variable, function?

Status
Not open for further replies.

dereferenced

Ars Scholae Palatinae
706
I don't think so. You'll have to use another compiler or run lint if it's that important to you.

Code:
#include <stdio.h>

int main(void)
{
    double foo;

    scanf("%d", &foo);
    return 0;
}

Code:
$ gcc -Wall test.c
test.c: In function `main':
test.c:7: warning: int format, double arg (arg 2)

Code:
C:\test>icl /W4 test.c
Intel(R) C++ Compiler for 32-bit applications, Version 5.0.1   Build 010525Z
Copyright (C) 1985-2001 Intel Corporation.  All rights reserved.

test.c
test.c(7): warning #181: argument is incompatible with corresponding format string conversion
      scanf("%d", &foo);
                  ^

Code:
C:\test>cl /Wall /Wp64 /GS /RTC1csu test.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.00.9466 for 80x86
Copyright (C) Microsoft Corporation 1984-2001. All rights reserved.

test.c
 

Tristram

Ars Scholae Palatinae
1,428
Subscriptor
You could always use a good lint program (it is a pretty good idea, regardless of compiler). This is not an excuse for MS not providing reasonable error messages, but there are a lot of syntactically correct programs that have semantic errors that a good lint program can flag. Heh, PC-Lint has examples every month in programming journals and on their web site. Many, I can't even figure out what is wrong.
 
Status
Not open for further replies.