bison-patches
[Top][All Lists]
Advanced

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

Re: C++: finish propagating the unsigned->signed conversion in locations


From: Akim Demaille
Subject: Re: C++: finish propagating the unsigned->signed conversion in locations
Date: Wed, 30 Oct 2019 07:09:06 +0100

Hi Hans,

> Le 29 oct. 2019 à 22:38, Hans Åberg <address@hidden> a écrit :
> 
> 
>> On 29 Oct 2019, at 21:30, Akim Demaille <address@hidden> wrote:
>> 
>> +  In C++, line numbers and columns are now represented as 'int' not
>> +  'unsigned', so that integer overflow on positions is easily checkable via
>> +  'gcc -fsanitize=undefined' and the like.  This affects the API for
>> +  positions.
> 
> There is std::streamoff for indicating file positions, it is signed, and can 
> represent the maximum file size. By contrast, int can overflow on modern 
> 64-bit computers.
> 
> https://en.cppreference.com/w/cpp/io/streamoff

We agree we need a debate on the actual type to use for positions in C++.  I 
think int is really reasonable and can hardly be defeated in real life (i.e., I 
can easily break it with forged examples, but that's not the point).

Paul has plans if we need to go further.

By anyway, before all this we need to evaluate if your C++ users are Ok with 
Bison 3.5 breaking its API by moving from unsigned to int.  Let's first address 
the problem of compatibility with 3.4 and before.


reply via email to

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