Re: Why MFC doesn't like /vmg?



Hi KMA,

Thanks. but then How I can fix the problem? Is it true that I have to put
#pragma pointers_to_members best_case.

in front of every MFC code?

May






"KMA" wrote:

>
> IIRC
>
> /vmb, /vmg (Representation Method)
> Home | Overview | How Do I | Compiler Options
>
> These options select the method that the compiler uses to represent pointers
> to class members. You can also use #pragma pointers_to_members in your code
> to specify a pointer representation.
>
> Command Line Project Settings Description
> /vmb Best-Case Always Use this option if you always define a class
> before you declare a pointer to a member of the class.
> /vmg General-Purpose Always Use this option if you need to declare a
> pointer to a member of a class before defining the class. This need can
> arise if you define members in two different classes that reference each
> other. For such mutually referencing classes, one class must be referenced
> before it is defined. You must then choose an inheritance model from the
> General Purpose Representation drop-down list box.
>
>
> To find these options in the development environment, click Settings on the
> Project menu. Then click the C/C++ tab, and click C++ Language in the
> Category box. See the choices under Representation Method.
>
> If you define a class before declaring a pointer to a member of the class
> using the Best-Case Always option, the compiler knows the kind of
> inheritance used by the class when it encounters the declaration of the
> pointer. Thus, it can use the smallest possible representation of a pointer
> and create the smallest amount of code required to operate on the pointer
> for each kind of inheritance.
>
> With the Best-Case Always option, the compiler issues an error if it
> encounters the pointer declaration before the class definition. In this
> case, you must either reorganize your code or use the General-Purpose Always
> (/vmg) option. You can also use the pointers_to_members pragma or define the
> class using the __single_inheritance, __multiple_inheritance, or
> __virtual_inheritance keyword. These keywords allow control of the code
> created on a per-class basis.
>
> For the Best-Case Always option, the corresponding argument to #pragma
> pointers_to_members is best_case.
>
> For information on the use of the __single_inheritance,
> __multiple_inheritance, and __virtual_inheritance keywords, see Inheritance
> Keywords in the Language Quick Reference.
>
>
>
>
>
> "Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
> news:71ggi15hktgkfute99a1e4tr5u3m3p38ge@xxxxxxxxxx
> > I don't suppose you would bother to tell what /vmq means? I'm not heavily
> into doing
> > decryption as an exercise, and my MSDN is on a different machine than my
> email machine.
> > joe
> > On Tue, 13 Sep 2005 15:30:02 -0700, may <may@xxxxxxxxxxxxxxxxxxxxxxxxx>
> wrote:
> >
> > >I have some sytemc code require to set the /vmg compiler option, and
> found
> > >out it will make the MFC application work improperly. Then I setup some
> very
> > >simple test : just use the helloworld MFC application (from MFC samples),
> > >test it with and without the /vmg option, and found out the about window
> stop
> > >working if /vmg is set. But a similar simeple test with win32 application
> > >works fine.
> > >
> > >My question is why the MFC doesn't like this /vmg option? How can make it
> > >work with my MFC applications?
> > >
> > >Thanks,
> > >May
> > Joseph M. Newcomer [MVP]
> > email: newcomer@xxxxxxxxxxxx
> > Web: http://www.flounder.com
> > MVP Tips: http://www.flounder.com/mvp_tips.htm
>
>
>
.



Relevant Pages

  • Re: Class members, pointers or not?
    ... > Is it best to declare class member objects as pointers or not pointers? ... using pointer members (and reference members) ...
    (comp.lang.cpp)
  • Re: Why MFC doesnt like /vmg?
    ... These options select the method that the compiler uses to represent pointers ... before you declare a pointer to a member of the class. ... pointer to a member of a class before defining the class. ...
    (microsoft.public.vc.mfc)
  • Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)
    ... > There seems to be some confusion between creating an offset to a record ... and simply using an Ada function pointer: ... one to declare the data member: ...
    (comp.lang.ada)
  • Re: Design..
    ... I've learnt c++ and mfc and im building a program that is using both, but i,mm having a problem combining all the code together. ... If class F has an object of class A as a member, then you should include a.h in f.h ... If class F has a pointer to an object of class A as a member, or has methods that take a pointer to A as a parameter, then you should use forward declaration of class A in f.h, and include a.h in f.cpp. ...
    (microsoft.public.vc.mfc)
  • Re: Declaring Pointer-To-Member Variables in Class
    ... >setting it to reference the appropriate member and then to call that member ... >I attempted to declare it like this: ... >class CMyClass ... That declares a normal member function that returns a pointer to member int ...
    (microsoft.public.vc.mfc)