Click here to Skip to main content
15,881,139 members

Comments by AndreFratelli (Top 40 by date)

AndreFratelli 10-Jul-12 20:42pm View    
No, I don't. I was just stating that I read the documentation and I understood it. Not sure what you mean by "forward documents"...

Well, not the case.

I believe I said this in my previous post: "The statement I have above should evaluate to bool, which is pretty much castable to int. So don't feel ashamed". Are you adding anything to it?

Still don't get it why I'm casting to bool? Ok... Can I vote 1 again?

Like I said, I understood your answer. Are you understanding the question? Here's an hint:

if ((bool)1 == (bool)2) { cout << "Native bool" << endl; }

Now do the same without casting.

Edit: wrong thread.
AndreFratelli 10-Jul-12 20:42pm View    
Deleted
No, I don't. I was just stating that I read the documentation and I understood it. Not sure what you mean by "forward documents"...

Well, not the case.

I believe I said this in my previous post: "The statement I have above should evaluate to bool, which is pretty much castable to int. So don't feel ashamed". Are you adding anything to it?

Still don't get it why I'm casting to bool? Ok... Can I vote 1 again?

Like I said, I understood your answer. Are you understanding the question? Here's an hint:

if ((bool)1 == (bool)2) { cout << "Native bool" << endl; }

Now do the same without casting.
AndreFratelli 10-Jul-12 13:43pm View    
Actually, the error message *is* about the #if directive, check the documentation yourself ;) "if they are used in an #if, #elif, or #else directive."

Why do you say that operator== doesn't evaluate to an integer constant? This is legal:

#if 1 == 1

The statement I have above should evaluate to bool, which is pretty much castable to int. So don't feel ashamed and explain to me why does the compiler complain about this...

Because if I don't cast to bool than it's an int comparison? 1 == 2 would be pretty obvious... However, if you have native bools (not sure if in all compilers) (bool)1 == (bool)2 is actually true! Guess what: I'm trying to check if the compiler has native bool support... Makes much sense to me.

Why do people always assume others haven't read the documentation? I've been using the preprocessor for 10+ years by now...
AndreFratelli 23-Jun-12 14:22pm View    
I didn't test it, it just says on the site that it doesn't support it... But that's a good point, though. Is it supposed to be supported in C++?
AndreFratelli 23-Jun-12 8:53am View    
The question is there...