If I have the very simple program
#include <unordered_map>
#include <iostream>
#include <string>
#include <stdint.h>
int main(int argc, char **argv) {
std::unordered_map<std::string, uint32_t> test_map;
test_map["test"] = test_map.size();
std::cout << test_map["test"] << "\n";
}
and I compile and run it on my macbook, I get
(venv) gmoss$ clang test.cpp -lc++ -o test.out
(venv) gmoss$ ./test.out
0
and then, if I go and compile and run it on an aws machine with ubuntu, I get
ubuntu:/home/george$ g++ test.cpp -o test.out -std=c++17
ubuntu:/home/george$ ./test.out
1
this just cost me like a day and a half of work, one of those "all the tests pass on my box, but not in the docker image" situations.
what's the explanation and how to avoid issues like this in the future?