The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: comp.lang.c++
From: Qi <n...@no.com>
Date: Tue, 27 Mar 2012 21:53:57 +0800
Local: Tues, Mar 27 2012 9:53 am
Subject: Re: macro definition for different compile configurations
On 2012-3-27 21:44, thomas wrote:
> Ok...
Please top quote. And keep your line width within 76
characters. > And I can write the two versions of the functions with the following declaration.
Using macro is neither neat nor easy to read.
> int f(PARAM_WITH_COMMA int y); > int f(PARAM_NO_COMMA); > In short I want to make my code neat and easy to read, that's to say, fewer "#ifdef" like stuff.
> So I'm trying to write some macros to shorten some word usage.
Whenever you can avoid macros, just avoid them. You are using C++. C++ can do most stuff that macro can do.
> I just gave an example above using two marco definitions.
There is comma_if in Boost library. You may check Boost
> Can I use just one macro to achieve the same thing?
preprocessor library. -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||