A
A
Airat19952016-10-25 21:53:49
C++ / C#
Airat1995, 2016-10-25 21:53:49

The number 0 as a symbol?

Hello, I just came across an interesting (as it seemed to me) feature. I'm not sure exactly why, but when calling overloaded functions with a value of 0, an error pops up

call to member function 'SetAttrib' is ambiguous
, and therefore it is necessary to cast this value to an int. Is this really due to the old understanding by the compiler that 0 == nullptr? Or am I not understanding something?
PS: I'm just writing using C++11 and it's strange that 0 and nullptr are the same thing for the compiler.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
romy4, 2016-10-25
@Airat1995

>weird that 0 and nullptr are the same thing to the compiler.
and they should be the same by definition.
>call to member function 'SetAttrib' is ambiguous
means you have a function that accepts both an int and a pointer. and 0 can be both

M
Maxim Moseychuk, 2016-10-25
@fshp

Or am I not understanding something?

In this case, I don't understand. So do you have 0 as a pointer or character?
Give the function signature.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question