Boost logo

Boost :

From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2007-12-04 10:36:03


 

> >> __LINE__ is not unique in a translation unit. For each included
> >> header, it is restarted from 1.
> >> So if you happen to use _COUNTER in two boost header files at the
> >> same line, and the two headers are included by the same
> c++ file, you
> >> end up with clashing counters.
> >> Corrado
>
>
> You totally missed the point!
>
> Macros like _COUNTER are not meant to be expanded inside of
> header files. They're designed to expand inside cpp source
> files, or be used as part of other macros.
>
> We all know what the limitations of __LINE__ are, we learned
> that stuff 20 years ago!

What about using BOOST_PP_COUNTER()/BOOST_PP_UPDATE_COUNTER() ?

Regards Hartmut


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk