U++ framework
Do not panic. Ask here before giving up.

Home » Developing U++ » U++ Developers corner » What does !! in e.g. FtpClient class mean?
Re: What does !! in e.g. FtpClient class mean? [message #39626 is a reply to message #39625] Wed, 10 April 2013 15:54 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1796
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Sometimes cast is necessary, e.g.:
int func(int n){
    return 1;
};
int func(bool b) {
    return 2;
}

int main() {
    int i=0;
    func(i) != func(!!i); // there is a difference ;-)
    func(!!i) == func((bool)i); // this is same ;-)
}


When you use '!' on anything else then bool, compiler will first cast it to bool (if possible) and then compute the negation. So !!x is equal to !( !( (bool)x ) ).

Honza
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IML including on multiple headers/cpp files
Next Topic: What does SSE2 usage enhance?
Goto Forum:
  


Current Time: Sun Jul 26 21:24:51 GMT+2 2026

Total time taken to generate the page: 0.00573 seconds