www.digitalmars.com         C & C++   DMDScript  

c++ - strict prototype

This simple source do not compile with strict prototype.
(It compiles with all others compilers -ansi /Za etc)

/***
#include <stdio.h>

#ifdef _WIN32
#define snprintf _snprintf
#endif

int main(int argc, const char** argv)
{
     char buf[32];
     return snprintf(buf, sizeof(buf), "%s", "Hello, World!");
}
***/

This source, if compiled with "-r" gives this:

return snprintf(buf, sizeof(buf), "%s", "Hello, World!");

t.c(10) : Error: function '_snprintf' has no prototype
t.c(12) : Error: need at least one external def
--- errorlevel 1

Is this a bug?

P.S.: With "-A -p" it compiles ok. With "-r" fail.
Note that first error dump shows "snprintf" (not preprocessed), 
while
next line shows function "_snprintf" which obviously has 
prototype.

michele pes
Jan 07 2013