Why aren’t they const?
I believe that’s flawed API design. Or am I missing something?
UINT GetWidth(); UINT GetHeight(); ...
vs.
UINT GetWidth() const; UINT GetHeight() const; ...
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.
Hard to say. I’d agree, but perhaps there is something in the implementation that prevents them from being
const, and that they didn’t want to add overhead to hide. Nowdays we have themutablekeyword, but I think that is younger than this API.Or maybe the designers of the API belong to the (sometimes shockingly large, imo) bunch of C++ developers who are hostile towards the
constkeyword, feeling that only makes things harder to use. I’m no Windows historian, so I can’t tell you. 🙂