help-flex
[Top][All Lists]
Advanced

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

Flex 2.5.23 beta and C++


From: Hans Aberg
Subject: Flex 2.5.23 beta and C++
Date: Tue, 22 Oct 2002 15:11:43 +0200

At 13:43 -0400 2002/10/21, W. L. Estes wrote:
>flex beta version 2.5.23 has been released at:
>
>ftp://ftp.uncg.edu/people/wlestes/

I get errors when trying to compile the Flex generated lexer under C++:

- Under C++, standard C construct end up in namespace "std". One can either
throw in a "using namespace C++", which is not so good because the
advantage of C++ namespaces is then lost, or write out the "std::" prefix
explicitly.

The latter is not so difficult if one adds a macro:
#ifdef __cplusplus
# define YY_STD(x)  std::x
#else
# define YY_STD(x)
#endif

Then write out:
    YY_STD(size_t)
    YY_STD(exit)
    YY_STD(malloc)
    YY_STD(realloc)
    YY_STD(free)

All in file skel.c.

- As for the macro FLEX_NEED_INTEGRAL_TYPE_DEFINITIONS, have you tried to
set it relative C version? -- I figure that these integral types are part
of C99.

There is a macro defined in C94, __STD_VERSION__, which expands to 199409L
in that version. And current standard C++ does not have those integral
types.

  Hans Aberg






reply via email to

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