开发者

What are these c++ statements doing

void usepr开发者_运维百科oxynum    ( ) { bUseProxy = true; return; };
void useacctnum     ( ) { bUseProxy = false; return; };

Can anyone give me some insight into what these c++ statements are doing? There are in a header file. bUseProxy is defined above

bool    bUseProxy;

I'm trying to figure out what useproxynum is (method call?) and I'm also trying to figure out how to find the code behind it.

This is in Visual Studio 6.


They are inline method definitions. The return statements are extremely unnecessary.

If it were me, i'd replace that with this:

void useNum(bool proxy) { bUseProxy = proxy; }


Those are not statements. Those are 2 methods (seems to be inline). One of them just sets true to bUseProxy variable the other sets false. Thats it.


They are both methods. The lines between the { } are the code. These are inlined methods and don't have a separate implementation in a .cpp file.


You can call useproxynum() in your code, and it will cause the bUseProxy value to be set to true.

Or, you can call useacctnum() in your code and it will cause bUseProxy to be false.

This bUseProxy is probably used somewhere else.

void doSomething(int id) {
    if(bUseProxy) {
        lookupWithProxy(id);
    }
    else {
        lookupWithAccNum(id);
    }
}

It's worth noting that the return; statements are kind of silly - reaching the end of the function block will cause the function to return all by itself.

"Trying to figure out the code behind it" ... no no, the code is in front of it =)


they are inline methods. when called, they set the value of the boolean, then return.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜