void l_log(const char* fmt, ...) __attribute__ ((format (printf, 1, 2))); The first argument of __attribute__(format) is the kind of format string to expect (printf, scanf, strftime). The second is the index of the format string argument. The third is the index of the first variable argument. In your case: int my_sprintf(MyBuffer, const char *format, ...) __attribute__ ((format (printf, 2, 3))); If the function is a member of a class, the indices must be shifted by 1, as the compiler passes "this" as the first function argument. For example: class something{ public: int my_sprintf(MyBuffer, const char *format, ...) __attribute__ ((format (printf, 3, 4))); }; Have fun. On Wednesday 12 November 2003 13:10, Bo Do wrote: > Hello all! > > I've written my own version of sprintf: > my_sprintf(MyBuffer, const char *format, ...) > I wonder if there's a way to use -Wformat, or any functionality of the > compiler, to make sure that the number of arguments supplied (the ... ) are > correct and have types appropriate to the format string specified. -Wformat > has the functionality I want, but it only checks the printf and scanf > functions in stdio. > > Thanks for any hints or help. > /Bo > > > --------------------------------------------------------------- > Acasa.ro vine cu albumele, tu vino doar cu pozele ;) > http://poze.acasa.ro/