Hi, On 05/02/2017 12:32 AM, Bruno Haible wrote:
Thomas Luthe wrote:
The manual only states that the string must contain exactly one number if end_of_parse is null, which it is not in my example. In the non-null case read_integer itself checks the end of the integer input and stores the position of the character after the integer in *end_of_parse. This works as expected for any non-integer characters like +,*,-,... with / being the only exception.
What you say is clearly a desirable behaviour of the read_integer function. However, I don't know whether read_integer can easily be changed to operate this way: the rational number and complex number readers possibly depend on the present behaviour.
It would come at the cost of the extra overhead that Thomas was fearing that has to be done by the caller now. (BTW, this cost is small compared to the O(N*log(N)) conversion to base 2^intDsize that comes afterwards.)
Also, the comments in <cln/integer_io.h> say read_integer is "undocumented" and that it "does strictly the same as the general read_complex". So, the relation between read_integer and the other readers is not clear to me.
Well, that comment is obviously wrong since read_integer *is* documented. I think that we should remove the comment and make it clear in the manual that this is a deprecated low-level function (or similar wording). Cheers -richy. -- Richard B. Kreckel <https://in.terlu.de/~kreckel/>