Re: Why MFC doesn't like /vmg?




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: Casting of pointer to member functions
    ... cast it back before any usage. ... The example above will compile only if /ymg compiler switch ... the bits that pointer is ... calling a member function through such pointer is ...
    (microsoft.public.vc.language)
  • Re: printf("%p ", (void *)0);
    ... A pointer to void is ... required to have the same representation as 'char *', ... > purposes of a pointer to void. ... and for precisely the same reasons. ...
    (comp.lang.c)
  • Re: A C++ Whishlist
    ... But that does mean that as a compiler writer, ... all function calls via a pointer to go through a vtable-like mechanism. ... >> You invoke undefined behaviour and the compiler is free to do as it ... or calling member functions via a NULL ...
    (comp.lang.cpp)
  • Re: ptr conversions and values
    ... >>> representation is a mapping, ... > Joining them in pairs is called mapping, ... Two pointer values are equivalent if they ... In case of no convenient pointer-integer conversion (on my imagined ...
    (comp.std.c)
  • Re: Pointer equality and dereferencing
    ... representation using some non-trivial algorithm. ... compiler might mistake it for a pointer that points to one past some array ... definition outside the scope of the standard, ...
    (comp.std.c)