On Tuesday, 3 July 2012 at 10:23:06 UTC, Mike Parker wrote:
On 7/3/2012 11:34 AM, Dustin wrote:
Hello,
I'm trying to follow along with a C++ tutorial and translate
it to D but
I don't know C/C++ well enough to understand this #Define
statement:
#define ARRAY_COUNT( array ) (sizeof( array ) / (sizeof(
array[0] ) *
(sizeof( array ) != sizeof(void*) || sizeof( array[0] ) <=
sizeof(void*))))
Can anyone help me understand this and translate it to a D
function?
Thanks for your time.
There is no reason to translate this to D. C++ doesn't keep
track of array lengths out of the box, so programmers either
have to do it themselves or implement some hackery like this
macro to figure it out. In D, none of that is necessary.
myArray.length
Same thing.
Ok cool that's why I like D much more than C++, it gets rid of a
lot of ambiguity. Thanks for the info.