This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Building Eterm - please more help


Hi Jean-Claude,


I wrote:
> >If PATH_MAX is not defined it defaults to 0 in preprocessor
> >conditionals.  That's just the definition of the C language.

Jean-Claude Gervais <jc.gervais@videotron.ca> writes:
> What? Are you sure? I always thought the symbols was UNDEFINED, and
> not 0.

There is a special exception for preprocessor conditionals.

> If the symbol PATH_MAX is undefined, the following statement
> 
> if ( PATH_MAX > 200 ) {
> }
> 
> will get expanded by the pre-processor to
> 
> if (  > 200 ) {
> }

If PATH_MAX is not defined during preprocessing, the preprocessor can
not know that it was supposed to be a preprocessor macro.  So your
code above will be just unchanged by the preprocessor.  After
preprocessing has been done, the actual C compiler will then complain
that PATH_MAX is an undefined variable or function.

There is the mentioned exception for preprocessor conditionals.  If,
after macro replacement, they contain any left-over identifiers, those
are replaced with 0.

> BY THE WAY, why not use _MAX_PATH instead? It is commonly defined by
> all compiler vendors.

That's an MS invention, I believe, it certainly is not in the
standard.  The standard macro for this feature is FILENAME_MAX,
defined in <stdio.h>.


so long, benny


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]