This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


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

re: gcj -D


> > If you're really jonesing for a preprocessor, just *use* cpp.  
> 
> No, this is bad advice, especially to someone new to
> Java. Java was designed to not need a pre-processor.
> For how to do conditional compilation, see the end of
> section 14.19 in the Java Language Specification:
> http://www.javasoft.com/docs/books/jls/html/14.doc.html#236365

I didn't necessarily mean it as advice, just to point out that cpp is a tool
that can be used for the job, if necessary.  A bit like using a sledgehammer to
fix a radiator (you'll probably break the radiator), but a tool nonetheless. 
But I think the person who asked the original question was sophisticated enough
about C to know this.  

Also, it's worth mentioning that a preprocessor is useful for more than
conditional compilation, and sometimes there are dirty shortcuts where it can be
usful (e.g., code generation), which is where #include and #define have their
uses.  But alas, I agree.  A preprocessor has no place in Java.

-- 
Fred Dushin                      mailto: fadushin@fadushin.ne.mediaone.net
                            -or- mailto: fadushin@syr.edu

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