On Tue, Jun 30, 2009 at 7:54 PM, Alfred Perlstein<alf...@freebsd.org> wrote:
> Hey Alex,
>
> People frown on macros, but this could be a good one:
>
> #define SPRINT(f, fmt) \
>        do {\
>                for (_i = 0; _i < sizeof(f)/sizeof(f[0]); i++) \
>                        printf(fmt, f[i]); \
>        }while(0)
>
> :D
>
> This should allow you to point to any _array_ and print each
> element of it using format "fmt".
>
> Example:
> SPRINT(Header->game_title, "%c");

Yes, it works, but using a loop to print a character array one char at
a time is terribly inefficient.

-- 
My preferred quotation of Robert Louis Stevenson is "You cannot
make an omelette without breaking eggs". Not because I like the
omelettes, but because I like the sound of eggs being broken.
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to