[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
examples: remove useless includes
From: |
Akim Demaille |
Subject: |
examples: remove useless includes |
Date: |
Tue, 13 Nov 2018 17:19:40 +0100 |
commit 8ff6ff3ab034bcc4294f57eba9d8c10e5d16aeee
Author: Akim Demaille <address@hidden>
Date: Tue Nov 13 06:43:50 2018 +0100
examples: remove useless includes
* examples/c++/variant-11.yy, examples/c++/variant.yy: here.
Fix warning when storing a long into an int.
diff --git a/examples/c++/variant-11.yy b/examples/c++/variant-11.yy
index be38589d..31c53ddb 100644
--- a/examples/c++/variant-11.yy
+++ b/examples/c++/variant-11.yy
@@ -37,9 +37,8 @@
%code // *.cc
{
-#include <algorithm>
+#include <climits> // INT_MIN, INT_MAX
#include <iostream>
-#include <iterator>
#include <sstream>
namespace yy
@@ -141,7 +140,10 @@ int
main (int argc, const char *argv[])
{
if (2 <= argc && isdigit (*argv[1]))
- max = strtol (argv[1], nullptr, 10);
+ {
+ auto maxl = strtol (argv[1], nullptr, 10);
+ max = INT_MIN <= maxl && maxl <= INT_MAX ? int(maxl) : 4;
+ }
auto&& p = yy::parser{};
p.set_debug_level (!!getenv ("YYDEBUG"));
return p.parse ();
diff --git a/examples/c++/variant.yy b/examples/c++/variant.yy
index 8fba6325..30dd19a4 100644
--- a/examples/c++/variant.yy
+++ b/examples/c++/variant.yy
@@ -33,9 +33,7 @@ typedef std::vector<std::string> strings_type;
%code // *.cc
{
-#include <algorithm>
#include <iostream>
-#include <iterator>
#include <sstream>
namespace yy
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- examples: remove useless includes,
Akim Demaille <=