deprecating sprintf(9)
Poul-Henning Kamp
phk at phk.freebsd.dk
Wed Sep 8 17:01:31 UTC 2010
In message <AANLkTin9WoQZxMc8U9MWPk3=OPTY0yzFYMTA68aYno2_ at mail.gmail.com>, Ryan
Stone writes:
>> #define bprintf(buf, fmt, ...) \
>> do { \
>> assert(snprintf(buf, sizeof buf, fmt, __VA_ARGS__) \
>> < sizeof buf); \
>> } while (0)
>
>Anyone using this macro is in for a nasty surprise when they compile
>with -DNDEBUG.
First, I think they will figure out pretty fast that it is a bad idea.
Second, -DNDEBUG has always been and still is a mistake.
That is why we have an explicit DIAGNOSTIC for the kernel.
Poul-Henning
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the freebsd-current
mailing list