[Top][All Lists]

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

Re: I need simpler examples (was: RE: Enhancement request: enabling Vari

From: Akim Demaille
Subject: Re: I need simpler examples (was: RE: Enhancement request: enabling Variant in C parsers)
Date: Mon, 10 Dec 2018 06:53:43 +0100

Hi Askar,

> Le 9 déc. 2018 à 22:12, Askar Safin <address@hidden> a écrit :
> Hi, Akim. Thanks a lot for your last two patches to /examples/.

Thanks for saying!

> Just a little note: your "!!", say, here: "if (!!getenv ("YYDEBUG"))" is very 
> ugly. It is difficult to understand, what is going on.

Well, it's probably surprising for those who don't know it, but it's a well 
known C/C++ idiom.

> Please, remove "!!" in whole source tree.

Sorry, I will not do that.

But I agree my use of !! inside the if was gratuitous.

commit a6d2b0a2769e5374db8d0dddf308187def97ab26
Author: Akim Demaille <address@hidden>
Date:   Mon Dec 10 06:33:50 2018 +0100

    examples: simplify computation of yydebug
    * examples/c/lexcalc/parse.y: here.

diff --git a/examples/c/lexcalc/parse.y b/examples/c/lexcalc/parse.y
index 5306de30..f2f29df1 100644
--- a/examples/c/lexcalc/parse.y
+++ b/examples/c/lexcalc/parse.y
@@ -86,9 +86,8 @@ void yyerror(int *nerrs, const char *msg)
 int main (void)
   int nerrs = 0;
-  // Enable parser runtime debugging.
-  if (!!getenv ("YYDEBUG"))
-    yydebug = 1;
+  // Possibly enable parser runtime debugging.
+  yydebug = !!getenv ("YYDEBUG");
   yyparse (&nerrs);
   // Exit on failure if there were errors.
   return !!nerrs;

reply via email to

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