Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Look at this horrible casting

Look at this horrible casting

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NicholasCougar
    wrote on last edited by
    #1

    Hi, Look at this nasty type casting. any one can help?

    (AFX_PMSG)(AFX_PMSGW)(int (AFX_MSG_CALL CWnd::*)(LPCREEATESTRUCT))OnCreate

    note:

    typedef void (AFX_MSG_CALL CCmdTarget::*AFX_PMSG)(void);

    These codes come from MessageMapping and Message Rounting. Thank you. Best regard. I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.

    T 1 Reply Last reply
    0
    • N NicholasCougar

      Hi, Look at this nasty type casting. any one can help?

      (AFX_PMSG)(AFX_PMSGW)(int (AFX_MSG_CALL CWnd::*)(LPCREEATESTRUCT))OnCreate

      note:

      typedef void (AFX_MSG_CALL CCmdTarget::*AFX_PMSG)(void);

      These codes come from MessageMapping and Message Rounting. Thank you. Best regard. I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.

      T Offline
      T Offline
      Tim Smith
      wrote on last edited by
      #2

      What are you asking about? But, in general you have to remember that the message map table just contains generic routine pointers. Thus, they have to be cast to the proper routine protocol when they are to be invoked. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

      N 1 Reply Last reply
      0
      • T Tim Smith

        What are you asking about? But, in general you have to remember that the message map table just contains generic routine pointers. Thus, they have to be cast to the proper routine protocol when they are to be invoked. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

        N Offline
        N Offline
        NicholasCougar
        wrote on last edited by
        #3

        Can you explain the code for me in detail? I mean word by word. Thank you. Best regard. I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.

        M 1 Reply Last reply
        0
        • N NicholasCougar

          Can you explain the code for me in detail? I mean word by word. Thank you. Best regard. I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.

          M Offline
          M Offline
          Mike Nordell
          wrote on last edited by
          #4

          NicholasCougar wrote: Can you explain the code for me in detail? I mean word by word. There is no need to explain it more than to say that they cast a pointer to a member function into another type of function pointer. But to spell it out, I think it's spelled something like: Emm eff see sucks, partially because Microsoft lagged ~5 years behind the competing C++ implementation, and partially since the AFX (remember, it was Application Framework eXperimental - probably with emphasis on the experimental part) group wasn't too good at neither design nor C++. Sure, using the inferior MS compiler they actually managed to make something work, sometimes... But the price we got to pay for this was un-typesafety that has wasted several hundred of thousands of developer hours around the globe to date.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups