POV-Ray : Newsgroups : povray.off-topic : 99 lines of C++ for an unbiased ray tracer : Re: 99 lines of C++ for an unbiased ray tracer Server Time
5 Sep 2024 01:25:04 EDT (-0400)
  Re: 99 lines of C++ for an unbiased ray tracer  
From: Orchid XP v8
Date: 14 Jan 2010 15:18:04
Message: <4b4f7bfc@news.povray.org>
Warp wrote:

>   There is a big difference between a pointer and an array in C (and hence
> in C++).

Really?

>   Since sizeof() of an array returns the total amount of bytes taken by
> an array, if you divide it by the amount of bytes of one element, you get
> the total number of elements.

This is plain. What surprises me is that sizeof() can give you an 
accurate size in the first place.

>   Of course what makes this confusing is that an array implicitly casts to
> a pointer of the element type. In other words, wherever a pointer of the
> element type is required, you can give an array of that type instead (there
> will be an implicity cast to the pointer type).

Ah. I didn't know that. All the books I've seen claim that they are *the 
same type*.

This makes more sense now...

>>>> Also, where THE HELL is "Xi" defined? I can see it *used* in several 
>>>> places, but I can't find a definitions.
>>> Line 48. It's an argument to the function.
> 
>> No, it's an argument in the radiance() function, I meant where is it 
>> defined in main().
> 
>   Line 82.

Yes, we've established that now. I wasn't aware that you could actually 
define more than one variable in a loop initialiser...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

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