Re: Why MFC doesn't like /vmg?



I don't understand why you would want to define these options anyway.

Ordinary C++, using whatever standard options VS employs, always allows

class Something;

class Other
{
  Something*	ps;
}

Why play around with it (or am I missing something) ?


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: the virtual keyword
    ... > you could not declare a body for it in the class it was declared virtual, ... This class can only be used as a base class, ... would result in a compiler error. ... function pointer that is added to the actual class. ...
    (comp.lang.cpp)
  • 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: What is wrong with this code?
    ... > There are language design issues which make it impossible for the compiler ... > function argument is treated as a pointer in both cases. ... > strcpy(array, src) ... > The recommended coding practice is to NEVER declare ...
    (microsoft.public.vc.language)
  • 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: 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)