Jump to content


Macros/preprocessor


  • Please log in to reply
No replies to this topic

#1 Cerium

Cerium

    Member

  • Members
  • PipPip
  • 27 posts
  • Gender:Male

Posted 20 May 2005 - 06:43 AM

Something I miss from C is the preprocessor, specificly the #define directive.

Ive read a number of articles that explain why they werent included with java, and the general replacement for them, but Ive come across a few situations where #define fixes the problem cleanly, while the java workarounds require redundant and/or sloppy code (Version control, for example).

I imagine you could just use a C compiler with the flag to output the code after the preprocessor does its work, but that gets messy as youd have to dump the output to a seperate folder or overwrite the original files, and THEN you have to do the actual compile the project. This in itself requires special configuration if you dump the output to a separate folder.

Ive also seen jappo and other such projects, but to be honest, trying to setup everything to work with JC was frustrating, and thats before I even started on adding jappo to ant.

Itd be handy if JC had a built in macro replacement feature, or even a full blown preprocessor. Though Id be quite content with the former, or even if someone took the time to come up with a clean way to use the above methods within JCreator.


Thanks, and sorry for the lack of proof reading.
-C