Click here to Skip to main content
12,754,455 members (34,876 online)
Rate this:
Please Sign up or sign in to vote.
See more: VisualC++
Hi All,

In my VC++ Application, I have been unable to resolve the following code snippet (similar),....
Class B : public A

   bool f1();
   bool f2();
   UINT8* rawmem;

B objb;

bool B::f1()
   rawmem = (UINT8*) new [200];
return true;

bool B::f2()
   ECODE ec;

   if(ec = (objb.rawmem) != EC_NO_ERR)   {
     SaveToLog(ERR_MSG, " Objb creation failed 0x%x",ec);
     return false;
   return true;

On build of above code: I am getting C2679: error which states >> binary '!=' : no operator found which takes a right-hand operand of type ECODE(or there is no acceptable conversion).

I suspect the error highlighted above is either because of want of operator overloading (!=) OR mismatch in parenthesis for the said line. I need some help in resolving the above error.(without resorting to reinterpret_cast)

Thanks in Advance...

With Regards,
Posted 19-Jun-12 5:48am
Updated 19-Jun-12 6:17am
Sergey Alexandrovich Kryukov 19-Jun-12 11:01am
Sandeep Mewara 19-Jun-12 11:18am
Is not that similar to :doh:


1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You are trying to compare a value of the pointer with, I guess, some integer constant indicating "no error". Not only it cannot compile, it makes no sense at all. If you managed to "convert" it (type cast), you would only make things worse. Do you really understand what a pointer does?

Sandeep Mewara 19-Jun-12 11:18am
5! :)

BTW, super name Sergey! :)
Sergey Alexandrovich Kryukov 19-Jun-12 11:21am
This is nothing but my real original name spelled in full. I'm tired of confusing people with my abbreviated name so they did not know how to address to me. The root of the problem is: my official English spelling "Sergey A Kryukov" was already taken as a CodeProject ID by another guy, so I always was uncomfortable with mine. All three parts of my name are so usual in Russians so I have a good number of exact namesakes, in a fully-spelled name.
Sandeep Mewara 21-Jun-12 16:57pm

Strange for me that a name like 'Sergey A Kryukov' was already taken as a CodeProject ID by another guy!
Sergey Alexandrovich Kryukov 29-Jun-12 20:51pm
There are very many people with similar name, where are one or two parts of name are the same, so not wonder there is one complete namesake...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 19 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100