🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: de.comp.lang.c++
1 messages
1 total messages Started by Mirko Streckenbach Sun, 10 Sep 1995 08:30
gcc __attribute__ fuer member functions
#383
Author: Mirko Streckenbach
Date: Sun, 10 Sep 1995 08:30
33 lines
1229 bytes
hallo!

ich habe versucht, __attribute__ format fuer member functions von c++ klassen
zu benutzen, leider mit wenig erfolg. wenn ich folgendes fragment

---
class xprintfclass {
public:
   void xprintf(char *,...) __attribute__ ((format (printf, 2, 3))); /* C */
};
void xprintf(char *,...) __attribute__ ((format (printf, 1, 2))); 

void test() {
   xprintfclass tst;

   tst.xprintf("%s %d %d",5,5,"rr");  /* A */

   xprintf("%s %d %d",5,5,"rr");      /* B */
}
---

mit "gcc -Wall" (gcc 2.7.0) uebersetze, bekomme ich zwei korrekte Warnungen
in zeile "B" und keine in zeile "A".
das 2,3 in zeile "C" scheint notwenig, weil gcc an member funktions offenbar
als erstes argument immer den this zeiger uebergibt. stellt man es auf 1,2
wird jedenfalls ein fehler gemeldet. oder unterliege ich hier einem irrtum?

bin fuer jede hilfe dankbar


ciao,
mirko.
-- 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads