Lately I had crazy time debugging a problem that eventually boiled down to non adherence of coding standards. Here it goes ...
A new API that looks as simple as below was added to a self sufficient component which compiles clean after the change was made.
int process_data( const char * str, char delim = ' ' );Suddenly another component that depends on the modified header fails to compile with error C2143: missing ')' before 'string'. That's a bit of shock!. By the way the other component doesn't use the new API at all.
It turned out that other component has defined a macro which is neither long nor uses UPPER_CASE. Of course it's their choice!
#define delim TEXT(" ") // andYou are punished for using a simple looking identifier (delim) and it takes efforts to understand that you are being punished!
#define TEXT( str ) L##str // just token pasting ...
No comments:
Post a Comment