Nmap Development mailing list archives

Re: [PATCH] Don't compile non-OPENSSL code when using OPENSSL andvice versa


From: "Kris Katterjohn" <kjak () ispwest com>
Date: Tue, 28 Feb 2006 09:10:43 -0800

From: Andreas Ericsson
Sent: 2/28/2006 1:53:46 AM

I'd be surprised if this actually makes the binary smaller. Any sane 
compiler recognizes and removes dead code when it's as obvious as this 
(most do when it's less obvious). In fact, even code like

#define HAVE_OPENSSL 0

if (HAVE_OPENSSL && some_other_condition)
      do_fun_things();

would be left out entirely. If do_fun_things() is static and called only 
from that point (or within blocks like this), it too will be removed.

While that's most likely very true, is there a reason to make the compiler do it
(just because it should) instead of the preprocessor (because you tell it)?

I'm not by any means saying you're wrong, but I do (at least) think using the
preprocessor #if/#else makes the code more readable/easier to understand rather
than just leaving it out there for the compiler to do.

Of course, whatever's best.

Kris Katterjohn



_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev


Current thread: