Home » Developing U++ » U++ Developers corner » What does !! in e.g. FtpClient class mean?
Re: What does !! in e.g. FtpClient class mean? [message #39668 is a reply to message #39667] |
Tue, 16 April 2013 19:42 |
|
mirek
Messages: 13976 Registered: November 2005
|
Ultimate Member |
|
|
Novo wrote on Tue, 16 April 2013 13:39 |
mirek wrote on Mon, 15 April 2013 12:42 | I am not FtpClient author and brief review of code indicates that in that particular case, using !! is redundant.
Anyway, sometimes it can have same benefit, see Prompt:
int Prompt(Callback1<const String&> WhenLink,
const char *title, const Image& iconbmp, const char *qtf, bool okcancel,
const char *button1, const char *button2, const char *button3,
int cx,
Image im1, Image im2, Image im3)
{
........
int nbtn = !!button1 + !!button2 + !!button3;
|
I can be wrong, but it is not guarantied that true == 1. You can only be sure that false == 0.
|
Actually, it IS guaranteed. Result of comparison operators and logical operators is always 0 or 1, since C was invented.
Mirek
[Updated on: Tue, 16 April 2013 19:42] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun May 12 02:14:49 CEST 2024
Total time taken to generate the page: 0.02057 seconds
|