This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A TINY BUG


Jason Zions wrote:
> 
> > I have found that the following bad code gives "exception" at run
> > time instead of error message at compilation time (b18 Win95):
> >
> > #include <stdio.h>
> > main(){
> >         printf("%s\n",sizeof(long));
> > }
> 
> No compiler will detect this error at compile-time. The prototype for
[munch]
> Summary: learn more about the language before whining about compiler
> errors. This is a programmer bug, not a compiler bug.
> 
> Jason Zions
> Softway Systems Inc., makers of OpenNT
> http://www.opennt.com

Jason, you are right in principal, and I hate to muddle 
the issue, but ... :)
gcc will indeed generate a warning for this. Perhaps the 
moral is that one should always turn on all compiler 
warnings.

[example]

sunlab1:~/cs217/scratch> cat test.c

#include<stdio.h>
int main ( void )
{
 
  printf("%s\n",sizeof(long));
  return 0;
}

sunlab1:~/cs217/scratch> gcc -Wall test.c
test.c: In function `main':
test.c:5: warning: format argument is not a pointer (arg 2)

--
 Matthew Moskewicz	|	mailto:moskewcz@Princeton.edu
 24A Holder Hall - PU	|	http://www.Princeton.edu/~moskewcz	
 Princeton, NJ 08544    |
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]