Re: some "newbie" questions
From: Alexander Bartolich (alexander.bartolich_at_gmx.at)
Date: 12/23/03
- Next message: Chris Torek: "Re: unsigned short addition/subtraction overflow"
- Previous message: Keith Thompson: "Re: 2 style questions"
- In reply to: Les Cargill: "Re: some "newbie" questions"
- Next in thread: Mark McIntyre: "Re: some "newbie" questions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 23 Dec 2003 00:55:49 GMT
begin followup to Les Cargill:
> Sean Kenwrick wrote:
>> You will never find a compiler that will complain about this
>> since the compiler knows nothing about what the format specifiers
>> mean in the printf() function.
>
> gcc does, just not in this case. It makes a special exception for
> printf, since the standard(s) refer(s) to it.
Just a minor nitpicking: The function name is not hard-wired into
gcc. The whole thing relies on cooperation by the header file.
# The `format' attribute specifies that a function takes `printf',
# `scanf', `strftime' or `strfmon' style arguments which should be
# type-checked against a format string. For example, the
# declaration:
#
# extern int
# my_printf (void *my_object, const char *my_format, ...)
# __attribute__ ((format (printf, 2, 3)));
#
# causes the compiler to check the arguments in calls to `my_printf'
# for consistency with the `printf' style format string argument
# `my_format'.
-- Für Google, Tux und GPL!
- Next message: Chris Torek: "Re: unsigned short addition/subtraction overflow"
- Previous message: Keith Thompson: "Re: 2 style questions"
- In reply to: Les Cargill: "Re: some "newbie" questions"
- Next in thread: Mark McIntyre: "Re: some "newbie" questions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|