public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* __attribute__((__format__)) syntax bug
@ 2003-04-21 13:52 Piotr Wyderski
  0 siblings, 0 replies; only message in thread
From: Piotr Wyderski @ 2003-04-21 13:52 UTC (permalink / raw)
  To: gcc

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-04-21 10:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-21 13:52 __attribute__((__format__)) syntax bug Piotr Wyderski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).