Current-Users archive

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

Re: using "(void)" casts to purposefully ignore return values



On Wed, Aug 31, 2011 at 09:02:14AM +0000, David Holland wrote:
> 
>  > At least strlcat will tell you that you have
>  > something wrong if the return value is checked, and that is the crux of
>  > my objection, why I spoke up in the first place - it is not always ok to
>  > ignore the returns from strl* because this may rise up and bit you by
>  > producing a string that is not nul terminated.
> 
> No, it cannot, unless you pass it an invalid string in the first place.
> 

The same could be said of any of the str* functions as has already been
stated.  As for strl* the invalid string merely needs to meet the
criteria of strlen(dst) > size - dst could be, in other contexts, a
valid string.

-- 
Brett Lymn
"Warning:
The information contained in this email and any attached files is
confidential to BAE Systems Australia. If you are not the intended
recipient, any use, disclosure or copying of this email or any
attachments is expressly prohibited.  If you have received this email
in error, please notify us immediately. VIRUS: Every care has been
taken to ensure this email and its attachments are virus free,
however, any loss or damage incurred in using this email is not the
sender's responsibility.  It is your responsibility to ensure virus
checks are completed before installing any data sent in this email to
your computer."




Home | Main Index | Thread Index | Old Index