ive been working on c++ on linux for the past 2 years,and switched to windows c++ programming recently.
can anyone tell me what that L is there in the argument of the function:
SHLoadImageFile(L"\\Program Files\\TrainingApp\\background.png");
and on viewing certain sample code in MSVS C++ i came across hundereds of typedefs like..
LPARAM// typedef LONG_PTR LPARAM… here LONG_PTR is again typedef as __w64 long
WPARAM// typedef UINT_PTR WPARAM…
so there is a lot of chained typedefs.. I never saw this much of typedef chaining on c++ programming on linux using gcc..
what i want to say is that it just creates more confusion in this way for windows application programming.. while ive seen application programming on linux using frameworks like Qt.. there such things are rarely used.. so is there specific purpose in typedefining again and again on MSVSC++?? for eg.. there are typdefs like
typedef int BOOL;
whats the use of this when normal bool is available already..?? there are hundred other cases ive come across where just to decide what data type to use becomes so difficult.. it becomes difficult to understand a pre written code in this fashion too..
Thanks.
The L in the argument is standard way of telling the compiler that the following string literal is unicode not single-byte characters. It is equivalent to the postfix L to indicate that a long integer constant.
The windows typedefs do seem confusing but once you get your head around the naming scheme they start to make sense.
You have to remember that this API originated in the early 90’s. Thus the typedefs are/were required to handle pointers on different architectures as well as 32/64 bit types and are also required to compile for non-intel windows machines.
The BOOL->int mapping is required asthe interface is C compatible (not c++) and thus can’t use the built in bool type.