Spend the whole afternoon to debug one issue. Completely confused on why I can print the first element from an empty list. It seems this is C++ issue or my program issue. It seems C++ randomly point to local address when I try to access the first element
int main(int argc, char **argv)
{
string crc_command = "ls /tmp/jacknotexist";
list<string> crc_output;
printf("list begin:%s\n", (*(crc_output.begin())).c_str()); // The result is "ls /tmp/jacknotexist". Why???
printf("list size:%d\n", crc_output.size()); // It is zero as expected.
}