The win32 API has for example two methods StrFormatByteSize and StrFormatByteSizeEx. Even though both the methods symantically do the same thing and the Ex counter part only offers a new parameter to slightly change the behavior then couldn't they have two overloads of the same function?
Is it a limitation of c/c++ or what is the possible reason for such an awkward convention?
The Win32 API is a C (not C++) API. The C language doesn't support overloaded functions.
Complete aside: The Win32 API uses __stdcall
-decorated functions, which include the number of bytes of parameters as part of the function name. __stdcall
is not part of the C language, but Windows linkers have to know about it.
Microsoft could have used this to implement some kind of overloading, but (since a lot of languages don't understand overloading) that would limit the number of languages that could be used to program Windows.
The C language doesn't support function overloading at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With