Re: [PATCH 0/3] yacc: compute the best type for the state number

2019-10-26 Thread Hans Åberg


> On 26 Oct 2019, at 09:05, Akim Demaille  wrote:
> 
>> Le 25 oct. 2019 à 18:13, Paul Eggert  a écrit :
>> 
>> On 10/25/19 7:15 AM, Théophile Ranquet wrote:
>>> 
>>> This sounds interesting and I would love reading what people have to
>>> say about this. However, I have failed at finding any such discussion
>>> or source. Could you perhaps share a few pointers?
>> 
>> 
>> I don't know of a good central email thread about this, but here's a style 
>> guideline:
>> 
>> https://www.gnu.org/software/emacs/manual/html_node/elisp/C-Integer-Types.html
> 
> About C++, this page has a good summary of the trend, which is "run away from 
> unsigned".
> 
> https://stackoverflow.com/questions/18795453/why-prefer-signed-over-unsigned-in-c
> 
> This talk is about undefined behavior, and why it's good to have some (in 
> particular because, as Paul already reported, this allows tools such as 
> sanitizers to catch these errors).
> 
> https://youtu.be/yG1OZ69H_-o

Undefined behavior also allows modern optimization, so it is important to stick 
to the lang specs, see:

http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_21.html





Re: [PATCH 0/3] yacc: compute the best type for the state number

2019-10-26 Thread Akim Demaille



> Le 25 oct. 2019 à 18:13, Paul Eggert  a écrit :
> 
> On 10/25/19 7:15 AM, Théophile Ranquet wrote:
>> 
>> This sounds interesting and I would love reading what people have to
>> say about this. However, I have failed at finding any such discussion
>> or source. Could you perhaps share a few pointers?
> 
> 
> I don't know of a good central email thread about this, but here's a style 
> guideline:
> 
> https://www.gnu.org/software/emacs/manual/html_node/elisp/C-Integer-Types.html

About C++, this page has a good summary of the trend, which is "run away from 
unsigned".

https://stackoverflow.com/questions/18795453/why-prefer-signed-over-unsigned-in-c

This talk is about undefined behavior, and why it's good to have some (in 
particular because, as Paul already reported, this allows tools such as 
sanitizers to catch these errors).

https://youtu.be/yG1OZ69H_-o

In particular from here, Chandler Carruth treats the case of unsigned/signed 
(IIRC, I did not re-watch this talk).

https://youtu.be/yG1OZ69H_-o?t=1475

Eric Niebler, of BOOST_FOREACH and Range v3 fame, started a "thread" about 
eliminating unsigneds from the C++ standard library V2.

https://github.com/ericniebler/stl2/issues/182