Why are global variables bad, in a single threaded, non-os, embedded application

It wouldn’t. The two fundamental issues with global variables is simply cluttering the namespace, and the fact that “no one” has “control” over them (thus the potential collisions and conflict with multiple threads). The “globals are bad”, like pretty much every other computer programming idiom is a guideline, not a hard and fast rule. When … Read more

C++, can I statically initialize a std::map at compile time?

It’s not exactly static initialization, but still, give it a try. If your compiler doesn’t support C++0x, I’d go for std::map’s iteration constructor: std::pair<int, std::string> map_data[] = { std::make_pair(1, “a”), std::make_pair(2, “b”), std::make_pair(3, “c”) }; std::map<int, std::string> my_map(map_data, map_data + sizeof map_data / sizeof map_data[0]); This is pretty readable, doesn’t require any extra libraries and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)