Boost logo

Boost Users :

From: Wu Yinghui, Freddie (yhwu_at_[hidden])
Date: 2006-03-08 04:00:02


Hi all,

I'm observing an interesting problem on MSVC71 regarding the use of
__LINE__ with Boost.Preprocessor.

The code looks like this
==== snip ====
#include <boost/preprocessor/cat.hpp>
#define UNIQUE_ID BOOST_PP_CAT(id, __LINE__)
#define UNIQUE_ID2 BOOST_PP_CAT(id, _MSC_VER)
int main()
{
     int UNIQUE_ID2 = 321;
     int UNIQUE_ID = 123;
     bool UNIQUE_ID = false;
}
==== snip ====

The compiler works fine with UNIQUE_ID2, but not UNIQUE_ID. The only
different in them is only the use of __LINE__ instead of _MSC_VER.

Does anyone on the list has more insight on this issue?

Or, what're the common ways to generate an unique identifier
automatically within certain scope?

Cheers,

Freddie

-- 
Wu Yinghui, Freddie
Research & Development
Software Engineer
Volume Interactions Pte Ltd
1 Kim Seng Promenade, #12-01
Great World City East Tower
Singapore 237994
Tel:   +65 62226962 (Ext 216)
Fax:   +65 62226215
Email: yhwu_at_[hidden]
URL:   http://www.volumeinteractions.com
Important:  This message is intended for the recipient(s) addressed 
above.  It contains privileged and confidential information.  If you are 
not the intended recipient, please notify the sender immediately by 
replying to this message and then delete it from your system.  You must 
not read, copy, use, or disseminate this communication in any form. 
Thank you.




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