Re: #ifndef in C

From: Harry Souders (hsouders@calweb.com)
Date: Mon Jul 26 1999 - 21:46:49 PDT


> What exactly does this mean in C?
>
> #ifndef NO_STDLIB_H

In my own words I like to think of it as "if not defined"

This help ya?

It is usually used in header files to keep from including the same
include file twice. Another way I have seen it used is to determine
what code will be compiled.

In the example above, I interpret it as: if NO_STDLIB_H is not
defined the lines following it are allowed to be interpretted by the
compiler until you see the words #endif.

There is a lot more to this #define, #ifdef, etc... stuff, and I am
not terribly good at explaining it. I'd install the gcc or egcs docs
or glibc docs (humm.. glibc looks best).

In any case #ifndef is a Preprocessor Directive and searching through
your C books or the net are your best bets.

-----------------------------------
Harry Souders - hsouders@pacbell.net
-----------------------------------



This archive was generated by hypermail 2b29 : Fri Feb 25 2000 - 14:29:06 PST