Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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: 1789
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: Sat May 11 06:55:36 CEST 2024

Total time taken to generate the page: 0.02981 seconds