CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 16

Threaded View

  1. #10
    Join Date
    Nov 2003
    Posts
    1,405

    Re: Multiple Inheritance Problem

    Quote Originally Posted by TheCPUWizard
    I believe that is still undefined behaviour (99.9998%), but much more likely to "randomly" work on 32 Bit Intel boxes at least...
    You mean assigning a pointer to DWORD (an integer type) is undefined? That's true but if DWORD is replaced by void* it's correct C++ and should be portable.

    Still the problem the OP reports persists also with void*. It has to be fixed the way I suggested, by restoring the typeless pointer to its actual type before upcasting.

    So it's okay to make a pointer typeless by casting it to void*, but be sure to cast it back to its proper type before doing something with it. If not you get undefined behaviour

    This is discussed in 5.6 Pointer to Void in Stroustrups C++ book.
    Last edited by _uj; May 4th, 2008 at 10:17 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured