On Tue, 22 Nov 2005 03:25:38 -0800, aravindh.k wrote:
Hi,
I want to define a macro that defines another on invocation. Somthing
like this:
#define MACRO_NR_1(FLAG, VALUE) #define MACRO_NR_1_##FLAG(VALUE)
(VALUE+FLAG)
# is, in fact, a pre-processor operator. It's operand should be one of the
function-like macro's parameters, the 'value' of which will then be
magically transformed into a string literal.
So this is definitely not going to work.
So that when I call MACRO_NR_1(10), the macro MACRO_NR_1_10 gets
defined. The macro above does not work.
Do you know how I may do this ?
You may not.
6.10.3.4 #3: "The resulting completely macro-replaced preprocessing token
sequence is not processed as a preprocessing directive even if it
resembles one."
The "resulting completely macro-replaced preprocessing token sequence"
being your fully processed macro replacement.
--
Pieter Droogendijk <pi****@binky.org.uk>
PGP/1E92DBBC [ Make way for the Emperor's Finest. ] binky.org.uk