|
Boost Users : |
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2006-03-09 03:41:00
> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Wu
> Yinghui, Freddie
> > Yes. There is nothing that the pp-lib can do about it.
>
> I agree. But I pointed this out after much effort trying to
> debug the mysterious bug. Maybe it'd be better to document
> this in pp-lib's manual as "known issues?" That'd make future
> victims' lives easier. :)
Maybe. I'm trying to avoid documenting bugs in preprocessor implementations in
the docs. For VC++ in particular, this is only one of many.
> >For the record, doing this sort of thing is almost
> guaranteed to produce ODR >violations. With that said...
>
> Well... I think I know what I'm doing now. The use of
> __LINE__ (or __COUNTER__ on MSVC) is working for me after
> combining with some salt as keyword. Thanks for your concern,
> but the current solution seems suffice for me purpose.
I'm sure it does. Rarely do compilers diagnose ODR violations. The Typeof
library does this also.
> >#include BOOST_PP_UPDATE_COUNTER()
> >BOOST_PP_COUNTER() // 3
>
> But this is not documented. :( I didn't know its existence
> until you told me and then I did a grep.)
It is documented, but I can't remember if it has been part of an official
release yet. It has been in the CVS for quite a while.
> >I could provide the means to seed this value for a
> translation unit, but I'm not >sure if this is really a good
> idea. Thoughts?
>
> I don't think there is a general solution for "all cases"
> here. (At least I don't have one with me right now.) But
> given some restricted usage, this solution actually works out
> quite well.
>
> BTW, I think I'm still sticking to __LINE__/__COUNTER__
> solution for now, since it is not possible for me to encode
> the "#include ..." line into my macro.
Sure. There are times (very few times, IMO) where it is necessary to
intentionally violate the rules defined by the standard. All I'm doing is
giving the obligatory warning.
Regards,
Paul Mensonides
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