Reputation: 2835
void useproxynum ( ) { 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.
Upvotes: 0
Views: 244
Reputation: 163288
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; }
Upvotes: 10
Reputation: 16597
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.
Upvotes: 4
Reputation: 82579
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 =)
Upvotes: 2
Reputation: 16673
they are inline methods. when called, they set the value of the boolean, then return.
Upvotes: 1
Reputation: 19054
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.
Upvotes: 2