[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Flex 2.5.23 beta and C++
From: |
Hans Aberg |
Subject: |
Re: Flex 2.5.23 beta and C++ |
Date: |
Tue, 22 Oct 2002 18:49:19 +0200 |
At 11:21 -0400 2002/10/22, W. L. Estes wrote:
>> Have you tried
>>
>> using namespace std;
>>
>> which only needs to appear once near the top of the file,
>> (and only for C++) which is aimpler and less ugly than
>> either std:: everywhere or macro hacking.
>
>I'm just going to include standard C headers in c++ scanners for
>now. When the re-write happens, there will be a separate c++ skeleton
>and it'll be pure c++.
It is a bad idea to put in
using namespace std;
as then all C++ std names will litter the global namespace. -- The problem
is that once introducing a "using" directive, there is no way to turn it
off. This is evidently a flaw with the C++ standard.
One alternative would be to write
using std::malloc;
etc. This adds the only the name ::malloc, etc.
But I would favor to make the quick fix I suggested, which does not alter
the std namespace at all, and later work up a better separate C++ skeleton
file.
For example, I never understood the "virtual" stuff in the current C++
FlexLexer.h file: This "virtual" stuff is used when one actually want to
vary the object polymorphicly at runtime, which does not happen what I know
with the lexer itself.
If one wants to make a heap instantiation of a derived class, then one can
use that class name instead of the base class.
Hans Aberg
- Re: Flex 2.5.23 beta and C++, (continued)
- Re: Flex 2.5.23 beta and C++, Hans Aberg, 2002/10/23
- Re: Flex 2.5.23 beta and C++, W. L. Estes, 2002/10/23
- Re: Flex 2.5.23 beta and C++, Hans-Bernhard Broeker, 2002/10/23
- Re: Flex 2.5.23 beta and C++, Wojciech Fraczak, 2002/10/23
- Re: Flex 2.5.23 beta and C++, Hans Aberg, 2002/10/23
- Re: Flex 2.5.23 beta and C++, Hans Aberg, 2002/10/23
- RE: Flex 2.5.23 beta and C++, Wayne Green, 2002/10/23
- RE: Flex 2.5.23 beta and C++, Hans Aberg, 2002/10/23
- Re: Flex 2.5.23 beta and C++, Bruce Lilly, 2002/10/22
- Re: Flex 2.5.23 beta and C++, W. L. Estes, 2002/10/22
- Re: Flex 2.5.23 beta and C++,
Hans Aberg <=