Original Post
I'm having a little bit of trouble in figuring out just what a piece of code does. Or rather, what the point of it is. If anyone's looking a the Source engine code, this is on line 244 in 'public\tier1\convar.h', and it deals with returning a boolean value for a console variable.
FORCEINLINE bool GetBool() const { return !!GetInt(); }
I haven't been able to find the definition of 'GetInt', but I'm fairly certain that it wouldn't do anything strange. What is the point of the two '!!'? I mean, just say the value returned was 5. This evaluates to 'true' in C++, so then !5 is false, and !!5 is true again. Could it be that they didn't want a compiler warning and they just don't like using casts?