[computer-go] C++ parameter passing
Peter Drake
drake at lclark.edu
Wed Aug 9 15:55:23 PDT 2006
Yes, it's a bad smell. This is a method on a BitBoard, which is
iterating through the points in that set, and xoring out the
corresponding elements of zobrist_numbers from the Zobrist has stored
in state. Since it has to access fields within this BitBoard, I put
it in the BitBoard class. It would be better OOD to use an iterator
of some kind, but I'm obsessed with speed this week.
Peter Drake
Assistant Professor of Computer Science
Lewis & Clark College
http://www.lclark.edu/~drake/
On Aug 9, 2006, at 3:46 PM, Darren Cook wrote:
>> I'd like to pass a large array by constant reference. I tried this:
>>
>> void remove_from_zobrist_hash(BoardState & state, color_t color,
>> const
>> uint64_t & zobrist_numbers[][])
>
> Taking a step back, zobrist_numbers[][] could be a private member in a
> class, and remove() could be a function on that class.
>
> ...actually I guess this is a member function of a class to store a
> zobrist hash? In that case zobrist_numbers should be a static data
> member of that class shouldn't it?
>
> Anyway, whatever, in the terms of Martin Fowler's Refactoring book,
> passing a multidimensional array as a parameter to a function is a
> "smell" and you should refactor.
>
> Darren
> _______________________________________________
> computer-go mailing list
> computer-go at computer-go.org
> http://www.computer-go.org/mailman/listinfo/computer-go/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://computer-go.org/pipermail/computer-go/attachments/20060809/2dded456/attachment.htm
More information about the computer-go
mailing list