C Macros
Re:C Macros
sure there is. And it's quite useful, as well
HTH,
~Adrian
Code: Select all
#define printf(...) kprintf(active_console, __VA_ARGS__);
~Adrian
Re:C Macros
Thanks where did you find that?
And another question...
What is the difference between the "#if !defined" and the "#ifndef" preprocessor directives? (if any).
And another question...
What is the difference between the "#if !defined" and the "#ifndef" preprocessor directives? (if any).
Only Human
Re:C Macros
I self needed them once for some printf+panic variations. Then I found the gcc pre-processor manual in the net.Thanks where did you find that?
Well um I've never seen a "#if !defined", but knowing thatWhat is the difference between the "#if !defined" and the "#ifndef" preprocessor directives? (if any).
#if my_program_version > 300
works well and works as expected,
#if !defined
is probably as much as
#if defined != 0
Cheers
Re:C Macros
nope. defined() is a preprocessor test for the argument being defined.#if !defined
is probably as much as
#if defined != 0
#if !defined(X)
is the same as
#ifndef X
but defined() is an expression which you can combine with other conditions, such as
#if (defined(X) && !defined(Y)) || Z>0
obviously when you are only interested in one thing being defined or not, it's easier to say:
#ifdef X // #if defined(X)
or
#ifndef X // #if !defined(X)