This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

__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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]