c++ - Why QString::toInt() receives a pointer and not a reference? -


qstring has few methods such toint(), tolong(), etc.

these methods receive pointer bool determines if conversion successful shown here:

int qstring::toint(bool * ok = 0, int base = 10) const 

my question is:

why 'ok' pointer , not reference?

i know implemented using either, don't see advantage of using pointer on reference.

i know implemented using either, don't see advantage of using pointer on reference.

you use reference default value

int qstring::toint(bool& ok = some_bool_guaranteed_by_the_library,                    int base = 10) const; 

the downside of library has provide some_bool_guaranteed_by_the_library globally available bool object. sounds designers of library did not see enough benefits provide such object.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -