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