For reference, I am compiling in C++11.
I am getting started on writing a chess engine using a bitmap representation of the board as a piece-centric approach. It seems like the suitable type to be using is uint64_t , however, after searching online quite a bit, i am a bit unsure about the "best practice" here.
I am beginning to define the .hpp file for the game board. Firstly, I am confused about the similar behavior that different code seems to exhibit.
#include <cstdint>
uint64_t board;
and
#include <cstdint>
std::uint64_t board;
both compile just fine. What is the difference between the two? Is one better than the other?
Additionally, I've noticed that I don't even need to include cstdint to be able to use uint64_t :
#include <iostream>
uint64_t board;
and
#include <iostream>
uint64_t std::board;
Both compile just fine, like the 2 cstdint examples above. As such, I am quite confused as to how uint64_t is supposed to be used in C++11, and why all 4 of those examples all do the exact same thing. I was told that you want to use cstdint , but it seems like iostream provides the type def as well? Is there a specific way that is the "best/safest" (for example in terms of namespace conflict)?