]> git.sesse.net Git - stockfish/commit
Correctly zero-initialize MainThread
authorJoost VandeVondele <Joost.VandeVondele@gmail.com>
Fri, 6 Jan 2017 15:16:07 +0000 (16:16 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 7 Jan 2017 09:02:43 +0000 (10:02 +0100)
commit1c316c41bb0b3a1522aecd0dd2447009f976ebd7
tree06a6e164ec114b71b7f27b107971b886b69810b5
parent90b052462cc473ee03df0e1613d1c9f81ca99887
Correctly zero-initialize MainThread

It can be used uninitialized in time management.
Fixes all valgrind errors on './stockfish go wtime 8000 btime 8000 winc 500 binc 500'

This is one (of the many) quirks of C++. There is a subtle difference between:

new Foo
new Foo()

The first statement calls the default constructor (that in case of a POD leaves data members
uninitialized), the second one performs a value-initialization (that in case of POD is
equivalent to a zero-initialization)

See:
http://stackoverflow.com/questions/620137/do-the-parentheses-after-the-type-name-make-a-difference-with-new
http://stackoverflow.com/questions/5116541/difference-between-creating-object-with-or-without

No functional change.
src/thread.cpp