[computer-go] C++ parameter passing

Weston Markham weston.markham at gmail.com
Wed Aug 9 14:44:10 PDT 2006


On 8/9/06, Weston Markham <weston.markham at gmail.com> wrote:
> It is usually safe to cast a two-dimensional array to a
> one-dimensional array, (occupying the same memory) as long as you
> correctly figure out what the offsets of the elements are within it.

I'm not sure that that is exactly what I meant to say....  The
following would be better:

It is safe to reference additional uint64_t's that are stored in
subsequent "rows" of a 2-d array through a pointer to the first
element in the 2-d array.  So:

uint64_t caller_array[50][50];

remove_from_zobrist_hash(state, caller_array[0]);

...will work, if the called function is aware that zobrist_numbers[50]
is caller_array[1][0].

Weston


More information about the computer-go mailing list