Is correct name enough to make it happen?

Posted by Knowing me knowing you on Stack Overflow See other posts from Stack Overflow or by Knowing me knowing you
Published on 2010-05-12T16:05:43Z Indexed on 2010/05/12 16:14 UTC
Read the original article Hit count: 172

Filed under:
|

Guys, I've just dipped in to limits.h by MS. I tried to check what's the return type for max() fnc and to my surprise I see something like this:

// TEMPLATE CLASS numeric_limits
template<class _Ty>
    class numeric_limits
        : public _Num_base
    {   // numeric limits for arbitrary type _Ty (say little or nothing)
public:
    static _Ty (__CRTDECL min)() _THROW0()
        {   // return minimum value
        return (_Ty(0));
        }

    static _Ty (__CRTDECL max)() _THROW0()
        {   // return maximum value
        return (_Ty(0));//EXACTLY THE SAME WHAT IN min<<------------------
        }
//... other stuff
};

so how is it possiple that in both min and max return does exactly the same? So does it mean if I would write makeSanwich() return (_Ty(0)) it would make a sandwich for me? How is it possible that having this same code just fnc names different we are getting different results?

© Stack Overflow or respective owner

Related posts about c++

Related posts about magic