Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Class member functions confused as Macros

Reply
Thread Tools

Class member functions confused as Macros

 
 
cweisbrod@cogeco.ca
Guest
Posts: n/a
 
      11-07-2006
Hi All,

I realize I may be posting to the wrong group, but I can't help but
think my problem is more related to C++ than Microsoft's particular C++
compiler.

I've been migrating a large project from CodeWarrior to Visual Studio
and I'm having some difficulty with the Microsoft compiler.

Here's the basic problem with simplified code:

class A
{
public:
bool IsMinimized(void);
};

bool A::IsMinimized(void)
{
return true;
}

int main()
{
A* theWindow = new A;
theWindow->IsMinimized(); // Problem here
delete theWindow;

return 0;
}

The problem is that the compiler has already encountered a macro
definition, as in:

#define IsMinimized(x) IsIconic(x)

And the compiler is warning me that my call to IsMinimized() "does not
have enough actual parameters for macro 'IsMinimized'."

Is there some way to resolve this issue short of renaming my class
member functions?

Thanks for any input.

Clint Weisbrod.

 
Reply With Quote
 
 
 
 
mlimber
Guest
Posts: n/a
 
      11-07-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I realize I may be posting to the wrong group, but I can't help but
> think my problem is more related to C++ than Microsoft's particular C++
> compiler.
>
> I've been migrating a large project from CodeWarrior to Visual Studio
> and I'm having some difficulty with the Microsoft compiler.
>
> Here's the basic problem with simplified code:
>
> class A
> {
> public:
> bool IsMinimized(void);


Abomination! (See
<http://groups.google.com/group/comp.lang.c++/msg/895f1f98c4488dda>.)

> };
>
> bool A::IsMinimized(void)
> {
> return true;
> }
>
> int main()
> {
> A* theWindow = new A;
> theWindow->IsMinimized(); // Problem here
> delete theWindow;
>
> return 0;
> }
>
> The problem is that the compiler has already encountered a macro
> definition, as in:
>
> #define IsMinimized(x) IsIconic(x)
>
> And the compiler is warning me that my call to IsMinimized() "does not
> have enough actual parameters for macro 'IsMinimized'."
>
> Is there some way to resolve this issue short of renaming my class
> member functions?


It's not related to Microsoft's compiler so much as their header files.
Don't include the offender (which you might be able to do if you skip
their all-inclusive stdafx.h-type construct) or #undef IsMinimized.

Cheers! --M

 
Reply With Quote
 
 
 
 
Frederick gotham
Guest
Posts: n/a
 
      11-07-2006
cweisbrod:

> Is there some way to resolve this issue short of renaming my class
> member functions?


Microsoft is a pack of retards -- you just have to get used to this sort of
tripe from them.

--

Frederick Gotham
 
Reply With Quote
 
Andrey Tarasevich
Guest
Posts: n/a
 
      11-07-2006
(E-Mail Removed) wrote:
> ...
> Is there some way to resolve this issue short of renaming my class
> member functions?
> ...


Do an '#undef IsMinimized' right after including the offending header file.

--
Best regards,
Andrey Tarasevich
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
overloading non-template member functions with template member functions Hicham Mouline C++ 1 04-24-2009 07:47 AM
overloading non-template member functions with template member functions Hicham Mouline C++ 0 04-23-2009 11:42 AM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
Explanation of macros; Haskell macros mike420@ziplip.com Python 80 11-07-2003 02:22 AM
Re: Explanation of macros; Haskell macros mike420@ziplip.com Python 1 10-07-2003 04:07 PM



Advertisments