[FFmpeg-devel] Unix "fileno" libavformat module
Wed Jul 11 09:51:36 CEST 2007
William Ahern <william at 25thandClement.com> writes:
>> > + (void)memcpy(buf, s->rbuf.r.pos, size);
>> why this cast ?
> Its not an uncommon style to "cast away" a return value for the purposes of
> inline documentation. The intent is to say, "I am willfully ignoring the
> return value". The sense becomes clearer for things like close(), and,
> especially, snprintf(). WIN32 snprintf() returns -1 on overflow, and notably
> does not guarantee null-termination for this condition (effectively the
> complete opposite of C99 snprintf()). I've noticed this in some of the
> ffmpeg code. A (void) cast in such a situation would (or should) serve to
> document that the author understood the behavior and implications.
All I've ever seen such casts indicate is the author using compiler
(or worse, lint tool) giving warnings unless those casts were added.
If done often enough, it could well become an unconscious habit.
In the memcpy() case, I can't recall having ever seen the return value
mans at mansr.com
More information about the ffmpeg-devel