[FFmpeg-devel] [PATCH] Implement the function cmdutils.c:parse_int_or_die

Måns Rullgård mans
Wed Feb 20 14:43:19 CET 2008


Michael Niedermayer wrote:
> On Wed, Feb 20, 2008 at 01:51:22AM -0500, D. Hugh Redelmeier wrote:
>> Sure, but I claim that any values of type int or int64_t will of
>> necessity (by way of guarantees in the C standard) be within the range
>> [LLONG_MIN, LLONG_MAX].
>
> That is not true. Quoting the C spec:
> --------
>  minimum value for an object of type long long int
>                     -9223372036854775807 // -(2^63 - 1)
>  LLONG_MIN

You missed the part that says of these values:

  Their implementation-defined values shall be equal or greater in
  magnitude (absolute value) to those shown, with the same sign.

It is perfectly legal for long long to be wider than 64 bits, but it
must be at least 64 bits.

> --------
>  minimum values of exact-width signed integer types
>                                            exactly -(2^(N-1) )
>  INTN_MIN
> --------

That bit isn't in my copy of the C99 standard, although I agree it is
the only possible interpretation.

>> | the != '\0' is also useless
>>
>> I think that it makes the code a lot easier to read.
>
> Peoples opinions differ. Ours is != 0 has to be removed.
>
>
>>
>> For example, see
>> the 7th bullet point of section 9 of this coding standard:
>>   http://www.chris-lott.org/resources/cstyle/indhill-annot.html
>> and expanded in the section "Simple Statements" in
>>   http://www.chris-lott.org/resources/cstyle/indhill-cstyle.html
>>
>> See the section "Expressions and Statements in
>>   http://www.jetcafe.org/jim/c-style.html
>>
>> See http://www.cs.uiowa.edu/~jones/syssoft/style.html#bool
>
> spare me of these please

Those are pretty fucked up rules, and they're still not the worst
of the so-called "coding standards" floating about.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list