Bruno Haible <br...@clisp.org> writes:

> This is more hairy than you might think. Because of the GCC attribute syntax.
>
> stdio.in.h does
>
> /* Don't break __attribute__((format(printf,M,N))).  */
> #    define printf __printf__
>
> because there are not many symbols that can be used in place of 'printf'.

Ah, interesting. I didn't even know that. Makes sense though.

> Do you have an idea for doing this nicely? Perhaps another kind of redirect?
> A 'static inline' function would not be good, because it cannot be used
> everywhere (ISO C 23 ยง 6.7.4.(3)). Maybe an 'extern inline'? Or can __asm__
> based redirection made portable across all systems?

I don't have any ideas at the moment. I'm not sure how portable the
__asm__ redirects are. Maybe something like:

    #define PERFER_ZPRINTF 1
    #include <stdio.h>

could include a header with extern inline functions?

Collin

Reply via email to