POV-Ray : Newsgroups : povray.off-topic : Smart little programming tricks, where to find ? : Re: Smart little programming tricks, where to find ? Server Time
11 Oct 2024 01:22:22 EDT (-0400)
  Re: Smart little programming tricks, where to find ?  
From: Darren New
Date: 19 Mar 2008 22:02:36
Message: <47e1d3cc@news.povray.org>
Warp wrote:
>   (OTOH, one could argue that understanding "0 < money" becomes easy when
> you use it a lot...)

Yes, it takes practice.

>   The form you suggest becomes a bit counter-productive when the expression
> is not a pure "between x and y", like for example:
> 
> if(10 < money*money && money*12 < 100)
> 
>   Now it becomes much harder to understand quickly what's going on.

If money squared is more than ten or money times twelve is less than a 
hundred.  Makes sense to me. :-)  But then, I'm used to it.

I've noticed since this came up that I'll even do things like
   if (i > 0^H^H^H^H^H0 < i) ....

>   In most cases the compiler will issue a warning anyways if you make
> the mistake. Never been a problem to me.

It depends on the language, and the compiler.  A lot of embedded 
compilers aren't too smart, and a lot of languages that adopted C syntax 
(PHP, Java, etc) aren't too smart about that too.

-- 
   Darren New / San Diego, CA, USA (PST)
     "That's pretty. Where's that?"
          "It's the Age of Channelwood."
     "We should go there on vacation some time."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.