#def question
From: ashish (ashishgupta82_at_gmail.com)
Date: 08/25/04
- Next message: John Hanley: "using #ifndef"
- Previous message: Gordon Burditt: "Re: malloc->free->damage: after normal block"
- Next in thread: RCollins: "Re: #def question"
- Reply: RCollins: "Re: #def question"
- Reply: bowsayge: "Re: #def question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Aug 2004 14:42:49 -0700
Hello,
Supposing I have a #def like so ..
#define A 10
Now A has been used everywhere in the code.
In loops ... for (i=0; i < A; i++)
And defines ...
int charArray[A];
And in structures
struct a {
int intarray[a];
};
Now, I want to define a variable B such that ..
#define B ( (my_mode) ? 20 : A)
Basically, B will be A (10 if my_mode is 0 (old) or 20 if my_mode is 1
(new).
Obviously this creates a problem with the integer array and the
structure definitions - I think I can do this only if it is a function
or in the for loop as above.
Is there any way I can achieve this or will I have to hardcode
#define B 20 and live with
int charArray [20]; etc. in all modes .
TIA
- Next message: John Hanley: "using #ifndef"
- Previous message: Gordon Burditt: "Re: malloc->free->damage: after normal block"
- Next in thread: RCollins: "Re: #def question"
- Reply: RCollins: "Re: #def question"
- Reply: bowsayge: "Re: #def question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|