Implicit conversion of 1.char* type to bool type
void a (bool input)
{
cout<< "I AMD First" <<endl;
cout<<input<<endl;
}
void A (const string &input)
{
cout<< "I amd Second" <<endl;
cout<<input<<endl;
}
int main (int argc,char **argv)
{
A ("str"); is the second a function called?
A (String ("str"));
return 0;
}
The char* type of "Str" is implicitly converted to type bool.
2. Use #pragma pack (1) in pairs:
First to introduce the background, I have a server here, will call a so at runtime, normally everything is normal, but after referring to a third party to the header file, in the call so a function of the core will drop. Baffled, and went to look at the definition of the third-party header file:
#ifndef Header_openapilog_protocol
#define Header_openapilog_protocol
#pragma pack (1)
Some structure definitions
#endif
Only the #pragma pack (1) was called and the #pragma pack () was not called at the end of the file! And my keynote server was recompiled, but so did not recompile, causing its common structure to be a byte-aligned one without doing it.
Those CPP details