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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,f292779560fb8442 X-Google-Attributes: gid109fba,public X-Google-Thread: fac41,af40e09e753872c X-Google-Attributes: gidfac41,public X-Google-Thread: f8c65,30e368bdb3310fe5 X-Google-Attributes: gidf8c65,public X-Google-Thread: 103376,30e368bdb3310fe5 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,30e368bdb3310fe5 X-Google-Attributes: gid1014db,public X-Google-Thread: 1008e3,30e368bdb3310fe5 X-Google-Attributes: gid1008e3,public X-Google-Thread: 10db24,30e368bdb3310fe5 X-Google-Attributes: gid10db24,public From: Tom Wheeley Subject: Re: Hungarian notation Date: 1996/05/20 Message-ID: <832631288snz@tsys.demon.co.uk>#1/1 X-Deja-AN: 155962661 x-nntp-posting-host: tsys.demon.co.uk references: <4adem2$b5s@mercury.IntNet.net> <4ahka7$o9m@inrou.erno.de> x-sig-by: Tomsystems Quote v1.2. (c)1996 Tom Wheeley, tomw@tsys.demon.co.uk x-mail2news-path: tsys.demon.co.uk organization: City Zen FM reply-to: tomw@tsys.demon.co.uk newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.edu,comp.lang.eiffel Date: 1996-05-20T00:00:00+00:00 List-Id: In article kanze@lts.sel.alcatel.de "James Kanze US/ESC 60/3/141 #40763" writes: > > |> "cannot" is too strong. The C language clearly allows the compiler to > |> know about standard library functions like printf. In fact at least > |> one free compiler does check the arguments against the formatting > |> directive, and more should do. > > This must be an amazingly brillant compiler, since the format strings > are almost always the result of a call to gettext (or its equivalent on > non-Unix systems), which means that they are read from an external file > which generally won't even exist on the machine which is doing the > compiling. Or does this compiler also know the semantics of gettext, The check is simply based on (AFAICS) a string literal format string (I cannot think of a good reason why not to use a literal format string, as you have that much more control over it.) > and simply suppose that the translators won't screw it up. (Wishful > thinking, of course. But I guess it really is too much to ask for a > warning along the lines of: ``Warning: the translator who does the > Estonian localization 5 years from now will accidentally change the %d > into a %s.'') Surely the localisation would not involve the changing of types, thus language specific text can be simply included via %s. Ok so it may be a tad slower, but it is a hell of a lot safer. At least, I *think* that that is what you are talking about. You would use printf(s); instead of printf("%s",s); ? Especially if reading from a file, I would never make code so easily breakable. .splitbung -- * TQ 1.0 * The 'Just So Quotes'. 'My Country right or wrong' is like saying 'My Mother drunk or sober.' " -- G. K. Chesterton