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


This is the kind of thing which compilers do not catch, because the problem
is specific to
the printf function which is a library unit, and not part of the language.
In other words, as long as the first argument to printf is of type char *,
then the function profile is matched.  If the string to which that first
parameter points is not a valid printf format string matching the other
pritf parameters, the compiler doesn't know it.  Furthermore, the string to
which the first parameter of printf points can be (and often is) modified at
run time, to fit the format to the occasion.

If you want to catch this sort of problem at build time, you need to use
"lint", and it is only
able to catch certain things because of the possibility of run-time
modification.

Better yet, write your program in ada95, using the free gnat-3.10p1 compiler
from
ftp://ftp.cs.nyu.edu/pub/gnat/winnt

David C. Hoos, Sr.,
david.c.hoos.sr@ada95.com

-----Original Message-----
From: Tage Westlund <tage.westlund@stockholm.mail.telia.com>
To: gnu-win32@cygnus.com <gnu-win32@cygnus.com>
Date: Monday, October 06, 1997 4:38 AM
Subject: A TINY BUG


>To gnu designers!
>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));
>}
>Tage
>
>-
>For help on using this list (especially unsubscribing), send a message to
>"gnu-win32-request@cygnus.com" with one line of text: "help".
>

-
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]