POV-Ray : Newsgroups : povray.off-topic : Teach yourself C++ in 21 days : Re: Days 1-5 Server Time
29 Jul 2024 18:27:12 EDT (-0400)
  Re: Days 1-5  
From: Darren New
Date: 20 Apr 2012 23:52:16
Message: <4f922ef0$1@news.povray.org>
On 4/20/2012 0:51, Invisible wrote:
>>>> The integral part of the value is assigned to the int.
>>> So... it always rounds towards zero?
>>
>> As long as they're both positive.
>
> Does it round towards zero, or towards negative infinity?

I don't remember. I never use it under those circumstances, probably because 
it's implementation-defined.

> Oh good. The book /insists/ that left-to-right order is guaranteed.

There are a handful of operators for which that's true. The rest, not so much.

> A better way might be to think of true and false as 1 and 0. (Although of
> course C allows true to be /anything/ that isn't 0, not just 1.)

The real way to think of it is "BZ" and "BNZ" - branch on zero, and branch 
on not zero.  Of course, if you don't know common modern assembler, that 
might not be any easier to remember.

> I'm currently trying to work out how I can compile a program where module 1
> refers to module 2, but module 2 also refers to module 1. As far as I can
> figure out, this is impossible...

Neither can actually refer to the other, so you're good to go there. Just 
use the normal header file stuff.

Everything you refer to has to be compiled in the same compilation unit, so 
C and C++ really don't have any trouble with circular references. A benefit 
I never really realized before.

-- 
Darren New, San Diego CA, USA (PST)
   "Oh no! We're out of code juice!"
   "Don't panic. There's beans and filters
    in the cabinet."


Post a reply to this message

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