tech-misc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: __attribute__((warn_unused_result)) for NetBSD?



>> [...] __attribute__((warn_unused_result)) [...]
>> It is interesting to hear/see NetBSD developer's opinions.

First off, I think that should be __warn_unused_result__.
warn_unused_result is in user namespace.

> More complete list of "protected" functions in glibc-2.7:

For functions like abs() which do not do anything except for their
return value, this is reasonable - or, at least, not unreasonable.

For functions like asprintf, or chdir, or even dup, which have
potentially useful side effects as well as return values, I would call
this somewhere between "obnoxious" and "broken" (exactly where on that
spectrum I'd place it would depend on my mood of the moment).  (Yes,
there are uses of chdir for which ignoring the return is reasonable;
there are even a few for dup, whose return value is predictable under
some circumstances.)

/~\ The ASCII                           der Mouse
\ / Ribbon Campaign
 X  Against HTML                mouse%rodents-montreal.org@localhost
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index