From what I'm understanding, from google, is that assertions are used when you 
do not expect a failure, or when the assertion has to be true. Exceptions are 
used when you expect a failure, even if its unusual or rare. Return codes are 
used when you know exactly how the code will fail/return, and its expected.

So, I think assert() is appropriate for the fortify_source warnings.

I'm going to start wrapping the additional assertions with '#ifdef 
_FORTIFY_SOURCE' so it does not affect anyone who doesn't need it, and should 
make it more likely to be accepted upstream.

robert

On Sunday 15 October 2006 16:43, Jan Dvořák wrote:
> Robert Connolly wrote:
> > Hello. Does it seem reasonable to use:
> > - fwrite (...);
> > + assert(fwrite (...));
> > ...
> > to deal with -D_FORTIFY_SOURCE warnings with fwrite(), dup(), chdir(),
> > fchown(), fgets(), write(), mktemp(), mkstemp(), mkdtemp(), and friends
> > who
>
> Seems very reasonable, but upstream may get confused by getting these
> assertions as bug reports. But it's a good thing anyway.
>
> - Mordae

Attachment: pgpUykxve2kBC.pgp
Description: PGP signature

-- 
http://linuxfromscratch.org/mailman/listinfo/hlfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to