From: dbe AT wgn DOT net ($Bill Luebkert) Subject: Re: A TINY BUG 6 Oct 1997 17:21:47 -0700 Message-ID: <34397CB7.2EA9D835.cygnus.gnu-win32@wgn.net> References: <01bcd272$8056fb20$928871a5 AT dhoos> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: "David C. Hoos, Sr." Cc: tage DOT westlund AT stockholm DOT mail DOT telia DOT com, gnu-win32 AT cygnus DOT com David C. Hoos, Sr. wrote: > > 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. Wrong, just add -Wall to your command line to pick up warnings and you should get something like: warning: format argument is not a pointer (arg 2) > Better yet, write your program in ada95, using the free gnat-3.10p1 compiler > from > ftp://ftp.cs.nyu.edu/pub/gnat/winnt Ada propaganda! :) > -----Original Message----- > From: Tage Westlund > To: gnu-win32 AT cygnus DOT 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 > >main(){ > > printf("%s\n",sizeof(long)); > >} -- ,-/- __ _ _ $Bill Luebkert (_/ / ) // // DBE Collectibles / ) /--< o // // http://www.wgn.net/~dbe/ -/-' /___/_<_