bison-patches
[Top][All Lists]
Advanced

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

Re: yacc.c: clarify the computation of yystate


From: Paul Eggert
Subject: Re: yacc.c: clarify the computation of yystate
Date: Tue, 23 Oct 2018 17:39:38 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

On 10/22/18 8:52 AM, Akim Demaille wrote:
+          const int yylhs = yyr1[yyrule] - YYNTOKENS;

I used to work with someone who liked to declare C local variables 'register const': 'register' so that he wasn't tempted to take the variable's address, and 'const' so that he wasn't tempted to modify the variable. I tried to talk him out of it, because to me 'register' and 'const' are complete overkill for local variables; the compiler and the human reader can easily deduce these properties statically, and they're not worth the valuable screen real estate that they take up. But I couldn't talk him into it, so 'register const int this' and 'register const int that' it was.

Anyway, my suggestion for Bison is to not bother with 'const' for locals. The Bison code is already plenty verbose and these 'const's are more trouble than they're worth.




reply via email to

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