Re: deprecating sprintf(9)

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Wed, 08 Sep 2010 17:01:30 +0000
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.
Received on Wed Sep 08 2010 - 15:01:31 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:07 UTC