the sqlite c api has the following function (and several like it):

    int sqlite_exec_printf(sqlite*,
                           char *sql,
                           int (*)(void*,int,char**,char**),
                           void*,
                           char **errmsg,
                           ...);

it would be nice if the header file prototyped it like so:

    int sqlite_exec_printf(sqlite*,
                           char *sql,
                           int (*)(void*,int,char**,char**),
                           void*,
                           char **errmsg,
                           ...) __attribute__((format(__printf__, 2, 6)));

for me, that catches quite a few annoying errors at compile time.

however i have to play tricks with sed to get this to actually do this
checking because the sqlite functions create two new function
specifiers: %q and %Q.  they do the proper escapes for strings in sql
(for idiot testing i change %[Qq] to %s and use a different sqlite.h
file with the __attribute__ bit in it).

it would be nice to be able to extend the current format archtypes.
maybe something like this:

    int sqlite_exec_printf(sqlite*,
                           char *sql,
                           int (*)(void*,int,char**,char**),
                           void*,
                           char **errmsg,
                           ...) __attribute__((format(
                                  __printf_extend__("Q", char *, "q", char *),
                                2, 6)));

is there any interest in this?  if i was to come up with a patch that
accomplished this, would it have a chance of acceptance?  is there a
better syntax that people might suggest?

kevin

-- 
kevin lyda ~ dems for torture: salazar(co/10) landrieu(la/08) pryor(ar/08)
[EMAIL PROTECTED] ~ nelson(fl/06) nelson(ne/06) lieberman(ct/06) 2/2/04
  Those who refuse to raise their voices against something as clearly evil
  as torture are enablers, if not collaborators.  --Bob Herbert, 2/11/04

Reply via email to