(Sensorflo) wrote:
# Im writting my own logger. Below is a very simplified snip of code,
# which illustrates my question. A message is Logged with the macro Log(
# priority, msg ). The message is only actually logged, if priority >=
# LOG_PRIORITY. But since priority and LOG_PRIORITY are both constants,
# the whole test is constant, which raises a warning. And I would like
# to be able to compile with no warnings, because I have read somewhere
# that gpl code should compile without warnings. If this test fails, no
# code at all should be generated for efficiency reasons. I made a
You can also use cpp-#if to avoid a cc-if.
Or stuff a sock into your nanny compiler's mouth. If your code is correct,
the warning is just noise. Changing the code to get rid of the noise instead
of getting rid of the noise maker is what's known as the tail wagging the dog.
If you've got an optimiser turned--and in some cases even without--code which
cannot be executed at all is painlessly excised from the object code. There
will be no runtime test, no wasted space, no robot rules of order, no air.
And your program remains readable and correct.
--
Derk Gwen
http://derkgwen.250free.com/html/index.html
So....that would make Bethany part black?