From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,af40e09e753872c X-Google-Attributes: gidfac41,public X-Google-Thread: 109fba,f292779560fb8442 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,30e368bdb3310fe5 X-Google-Attributes: gid103376,public X-Google-Thread: 10db24,30e368bdb3310fe5 X-Google-Attributes: gid10db24,public X-Google-Thread: f8c65,30e368bdb3310fe5 X-Google-Attributes: gidf8c65,public X-Google-Thread: 1014db,30e368bdb3310fe5 X-Google-Attributes: gid1014db,public X-Google-Thread: 1008e3,30e368bdb3310fe5 X-Google-Attributes: gid1008e3,public From: willer@carolian.com (Steve Willer) Subject: Re: Hungarian notation Date: 1996/05/23 Message-ID: <31a3b1b5.442039268@sqarc>#1/1 X-Deja-AN: 156230929 sender: news@sq.com (News Administrator) references: <4adem2$b5s@mercury.IntNet.net> <4ahka7$o9m@inrou.erno.de> <4n6off$6e2@mikasa.iol.it> <3198F30F.2A2@zurich.ibm.com> <319B2494.68AB@platsol.com> organization: Carolian Systems, Toronto ON newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.edu,comp.lang.eiffel Date: 1996-05-23T00:00:00+00:00 List-Id: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) wrote: >This must be an amazingly brillant compiler... It is. It was written by the FSF people. It's called "gcc". :-) In particular, gcc checks the arguments of the printf family against the formatter string when the -Wall option is on (actually, I'm sure it's a specific warning, but I always use -Wall). It only warns with these specific functions; if you declare your own function that uses varargs and vsprintf, it won't check it. Yes, it's a hack, but it's a really _nice_ hack. >This isn't to say I approve of Hungarian notation, even in C and used >with printf. Nor to criticize a compiler from generating a warning on >obviously bad code. Just that this warning won't really be as useful >as one would like in commercial software. You really think so? Perhaps I'm misunderstanding you. A common mistake around here is to write something like: printf("The number is %n\n",mynumber); ...which would only crash when the program hits this line of code, and then only if "mynumber" had a value that made it crash. I can't tell you how many times we've made this mistake and gcc's caught it (actually, I could probably guess: maybe 10 over the last year and a half).