__attribute__((__format__)) syntax bug
Piotr Wyderski
piotr.wyderski@hoga.pl
Mon Apr 21 13:52:00 GMT 2003
Hello,
there's a bug in the syntax of the __attribute__((__format__))
in C++. It works correctly with static class member functions
and "free-standing" functions, but nonstatic member functions
need to shift the argument positions by 1, as shown below.
class X {
VOID F(s,...) __attribute__((__format__(__printf__,2,3)));
};
"s" is the first parameter, but must be indicated as the second one.
I suspect this is because of implicit "this" pointer passing, but the
end user should not see such things. So there are two possible
solutions:
1. Fix the compiler to detect whether the __format__-ed function
is static or nonstatic. This would be the cleanest solution.
2. Update the product documentation to indicate this behaviour.
This would be a dirty kludge, but acceptable, if further compilers
will be backward-compatible with this bug.
Best regards
Piotr Wyderski
Serwis www.logo.hoga.pl - sciągaj bajery na telefony
Nokia, Siemens, Alcatel, Ericsson, Motorola,Samsung
------------------------------------------------------------
Promocja!!! rabat 40 % na zakup mks_vir 2003 dla klientów Connect , którzy
posiadaja kupony rabatowe.
More information about the Gcc
mailing list