Is
#define LBitmap std::list < CBITMAP *>
a good practice?
Edit:
Allright, what can I do to convince my boss that this is bad practice?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, its not a good practice to use #define in C++.
Its good to use typedef as this has a well defined scope
typedef is scope defined and compiler interprets its definition each time it meet which is not the in case of #define. #define is interpreted as compile time itself.
Here is the MSDN definition of typedef and #define
A typedef declaration introduces a name that, within its scope, becomes a synonym for the type given by the type-declaration portion of the declaration
When using DEFINE statements, all instances of that statement are replaced by the value of the statement during a preprocessing phase.
To convince your Boss
CHARPTR a, b;After preprocessing, that line expands to
Here, only variable a is of type char * whereas b is simply char
If you use typedef
Here both a and b are both of type char *