This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
__attribute__((__format__)) syntax bug
- From: "Piotr Wyderski" <piotr dot wyderski at hoga dot pl>
- To: <gcc at gcc dot gnu dot org>
- Date: Mon, 21 Apr 2003 12:17:25 +0200
- Subject: __attribute__((__format__)) syntax bug
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.