Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 08 Sep 2010 17:01:30 +0000
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        Ryan Stone <rysto32@gmail.com>
Cc:        mdf@freebsd.org, freebsd-current@freebsd.org
Subject:   Re: deprecating sprintf(9) 
Message-ID:  <67330.1283965290@critter.freebsd.dk>
In-Reply-To: Your message of "Wed, 08 Sep 2010 12:47:41 -0400." <AANLkTin9WoQZxMc8U9MWPk3=OPTY0yzFYMTA68aYno2_@mail.gmail.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <AANLkTin9WoQZxMc8U9MWPk3=OPTY0yzFYMTA68aYno2_@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@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?67330.1283965290>