[m-rev.] for review: Make base_string_to_int check overflow/underflow for all bases.

Julien Fischer jfischer at opturion.com
Mon Feb 16 15:43:31 AEDT 2015


On Mon, 16 Feb 2015, Peter Wang wrote:

> On Mon, 16 Feb 2015 13:07:49 +1100 (AEDT), Julien Fischer <jfischer at opturion.com> wrote:
>>
>> Hi Peter,
>>
>> On Mon, 16 Feb 2015, Peter Wang wrote:
>>>
>>> I also considered using `integer' in place of the string representation.
>>> What do you think?
>>
>> On balance, I don't have any objection to doing that.  'integer' is
>> certainly a safer representation than 'string'.
>> Also, presuambly if you are going to use the value of a big_integer and
>> not just spit out an error message, then you will be converting it to an
>> integer at some point anyway.
>>
>> The only downside seesm to be that some code may break because it now
>> needs to import the integer module, but that's easily fixed.
>>
>> Would you omit the base argument if 'integer' were used?
>
> No, the base argument is required to treat non-decimal literals
> differently in Mercury source files.

Ok.

> Code which handled the old big_integer/1 constructor will need to be
> updated either way.

There shouldn't be much of that though since it I don't think there
are that many direct users of library/lexer.m.

Cheers,
Julien.



More information about the reviews mailing list