Boost logo

Boost Users :

From: Chuck Siska (chuck.siska_at_[hidden])
Date: 2001-12-18 13:36:05


gustavo --

the only way is to run the preprocessor, cpp, explicitly. then you
can run it twice to fully expand the code darin shows below, once
explicitly and once implicitly by running the compiler.

-- chuck

Darin Adler wrote:
>
> On 12/17/01 7:00 PM, "Gustavo Guerra" <gustavobt_at_[hidden]> wrote:
>
> > So, does anyone has any suggestions on how to implement my MAKE_FLAG_TYPE<N>
> > macros using the Preprocessor library? Or is it just not possible?
>
> The underlying issue is that you can't use a macro to define a macro. That
> just how the C and C++ language macros work.
>
> So
>
> #define X #define Y 1
> X
>
> will not allow you to define Y by invoking X. You'll just get a syntax error
> when the compiler sees the "#define" after expanding X.
>
> I think the answer then is that it's just not possible, although there still
> may be some creative way to use the PREPROCESSOR library to help with what
> you are trying to do.
>
> -- Darin

-- 
                                           |\_/\_.-'""``:-._       
What is life without looking for           . . `; -._      )-;-,_`)
the next cute little bug to play with?     v_,-    _  ),(,.\  ``-' 
                                          _.- _.,-_/ /  ((.'       
-- chuck.siska_at_[hidden]  `<}:..     ((,.-'   ((,/

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net