Eccoti un code completo. Questo forse può esserti d'aiuto:
codice:
debug.h
#ifndef _MY_DEBUG_
#define _MY_DEBUG_
#define FUNNAME
#define NUMLINE
#define NUMARGS
#define RETTYPE
#define SETVAL(NAME, LINE, ARGS, TYPE) \
{ \
\
#undef FUNNAME \
#undef NUMLINE \
#undef NUMARGS \
#undef RETTYPE \
\
#define FUNNAME (NAME) \
#define NUMLINE (LINE) \
#define NUMARGS (ARGS) \
#define RETTYPE (TYPE) \
\
}
#define PRINTDEBUG() \
{ \
\
printf("function name: %s\n" \
"number of lines: %lu\n" \
"number of arguments: %lu\n" \
"type of return: %s\n", \
(FUNNAME), \
(NUMLINE), \
(NUMARGS), \
(RETTYPE)); \
\
}
#endif
Come si usa lo capisce anche mio nonno.
bye