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

Michael Niedermayer michaelni
Sun Feb 17 20:31:08 CET 2008


On Sun, Feb 17, 2008 at 01:40:47PM -0500, D. Hugh Redelmeier wrote:
> | From: Michael Niedermayer <michaelni at gmx.at>
> 
> | Id prefer
> | double parse_number_or_die(const char* numstr, int type, double min, double max, const char* error);
> | 
> | d= parse_number_or_die("12234", OPT_INT, 1, 100, "blah blah");
> 
> I really really distrust using floating point when integers are
> expected.  (To be honest, I distrust using floating point for anything
> where an exact result is expected.)
> 
> Do we really want to allow "3.9" when the context calls for an integer?

no, why do you think type (OPT_INT) is passed?


> 
> Theoretically, a C implementation could have some ints that are not
> representable as doubles.  I don't think that such an implementation
> exists, but it still makes me uncomforable.

We could also have a int64_t and a double one of the function.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080217/a84b631a/attachment.pgp>



More information about the ffmpeg-devel mailing list