Account name:
Password
(OpenID?)
(Forgot it?)
Remember Me
You're viewing
simont
's journal
Create a Dreamwidth Account
Learn More
Interest
Region
Site and Account
FAQ
Email
Reload page in style:
site
light
Evil preprocessor hack of the day
[
entries
|
reading
|
network
|
archive
]
simont
[
userinfo
|
dreamwidth userinfo
]
[
archive
|
journal archive
]
Wed 2007-04-18 17:39
Evil preprocessor hack of the day
Link
Reply
geekette8.livejournal.com
Wed 2007-04-18 19:55
OK, I have done [what I consider to be relatively] complicated things with the C pre-processor, but I don't understand why you needed two levels of CAT definition. What's wrong with
#define CAT(x,y) x ## y
?
Link
Reply to this
|
Thread
simont
Wed 2007-04-18 20:07
If you do that, then
CAT(foo,__LINE__)
gives you the fixed token
foo__LINE__
, instead of giving you
foo23
or
foo5097
or other such things.
Link
Reply to this
|
Parent
|
Thread
geekette8.livejournal.com
Wed 2007-04-18 20:42
Ah, gotcha. Thank you!
Link
Reply to this
|
Parent
navigation
[
go
|
Previous Entry
|
Next Entry
]
[
add
|
to Memories
]
#define CAT(x,y) x ## y?
CAT(foo,__LINE__)gives you the fixed tokenfoo__LINE__, instead of giving youfoo23orfoo5097or other such things.