bug-gmp
[Top][All Lists]
Advanced

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

changing mpz_set_str to fail on whitespace


From: Fabrice Bauzac
Subject: changing mpz_set_str to fail on whitespace
Date: Wed, 09 Jul 2003 17:56:43 +0200

Hello,

I read this:

- Function: int mpz_set_str (mpz_t ROP, char *STR, int BASE)

     Set the value of ROP from STR, a null-terminated C string in base
     BASE.  White space is allowed in the string, and is simply
     ignored.  The base may vary from 2 to 36.  If BASE is 0, the
     actual base is determined from the leading characters: if the
     first two characters are "0x" or "0X", hexadecimal is assumed,
     otherwise if the first character is "0", octal is assumed,
     otherwise decimal is assumed.

     This function returns 0 if the entire string is a valid number in
     base BASE.  Otherwise it returns -1.

     [It turns out that it is not entirely true that this function
     ignores white-space.  It does ignore it between digits, but not
     after a minus sign or within or after "0x".  We are considering
     changing the definition of this function, making it fail when
     there is any white-space in the input, since that makes a lot of
     sense.  Send your opinion of this change to <address@hidden>.
     Do you really want it to accept "3 14" as meaning 314 as it does
     now?]

And I think it would be better if the function was changed as
described, i.e. it should fail on whitespace.

Sorry if this opinion arrives too late.

Have a nice day,

-- 
fabrice bauzac
Software should be free.  http://www.gnu.org/philosophy/why-free.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]