gcj -D
Fred Dushin
fadushin@fadushin.ne.mediaone.net
Tue Oct 19 13:44:00 GMT 1999
> > 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
More information about the Java
mailing list