Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion macro definition for different compile configurations
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
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Qi  
View profile  
 More options Mar 27 2012, 9:53 am
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.
> 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.

Using macro is neither neat nor easy to read.
Whenever you can avoid macros, just avoid them.

You are using C++. C++ can do most stuff that macro can do.
When you want to write a macro, rethink again.

> I just gave an example above using two marco definitions.

> Can I use just one macro to achieve the same thing?

There is comma_if in Boost library. You may check Boost
preprocessor library.

--
WQ


 
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.