Re: macro definition for different compile configurations
On 3/27/2012 3:29 AM, thomas wrote:
Hi,
I'm stucked by something appears really simple at first sight.
I have a function definition with different parameter list in different compile configurations. for example.
--------------------------
CONF1:
int f(int x, int y){}
int g(int x){}
CONF2:
int f(int y){}
int g(){}
Why don't your functions declared returning a value return a value? Are
those supposed to be definitions or declarations?
You *do* know that in C++ you're allowed to have functions with the same
name and different argument list, right? That's called "overloading".
You *can* declare/define your 'f' and 'g' all in the same scope.
----------------------------
I'm trying to define some marco like
#if CONF1
#define PARAM(list) int x, list
#elseif CONF2
#define PARAM(list) list
#endif
And use it HOW? To achieve WHAT?
But it cannot work for func g() definition in CONF1 since a "," is appended unexpectedly.
"Cannot work" for what?
It seems to be really simple, but I am now a little dumb how to define one and solve it elegantly.
What exactly are you *trying to do*? You're stating that your solution
is not working, but what is *the problem* that you're trying to solve?
(And please don't tell us that the problem is that the solution is not
working)
V
--
I do not respond to top-posted replies, please don't ask