[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
It all depends on how large and complex the application is. Ifdefs dont' scale well to large code bases. In GT.M (http://www.sanchez-gtm.com), which is between a quarter million and a half million lines of code that implements a high performance transaction processing database engine and associated compiled scripting language, we try to abstract out platform dependencies into header files wherever possible, e.g., by encapsulating functionality in macros. Where warranted (e.g., in the compiler), we have platform dependent versions of source files. Source code for the implemnentations of GT.M on x86 GNU/Linux and HP Alpha/AXP Tru64 UNIX are GPL'd at Source Forge (http://sourceforge.net/projects/sanchez-gtm) and you can compare the two code bases to see how it's done. [This is a real-world database engine that runs tens of millions of bank accounts around the globe.]
Of course, if your application is small, ifdef away...
-- Bhaskar
I'm doing a code port from Solaris to Suse Linux. The ported code will need to run on both so I need a preproccessor directive in the .c files like:
#ifdef SUSE ...Linux code #else ...Solaris code #endif
I'm using gcc. Does anyone know of an existing macro for Suse or Solaris to do this with? Or another good way of doing it?
Thanks, -Dan
___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug