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. Injected code weirdness....VC 7

Injected code weirdness....VC 7

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
1 Posts 1 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.
  • J Offline
    J Offline
    jarl
    wrote on last edited by
    #1

    I just had a look at the code injected by the compiler when using the __event, __hook and __raise keywords on native C++ code. The sample in the help-files which come with VC 7.0 define a void-event like so; __event void MyEvent( int value ); and __hook a reciever to it and subsequently __raise it. Fine. So I changed it to this; __event int MyEvent( int value ); and looked at the generated code for the __raise, ( now returning an int ), which is like so; inline void CSource::MyEvent(int i1) { __EventingCS.Lock(); __eventNode_CSource_MyEvent* node = __eventHandlerList_CSource_MyEvent; int hr = (int) 0; for (; node != 0; node = node->next) { hr = node->__invoke(i1); if ( hr!=0 ) { return hr; //< BAD STUFF HAPPENS HERE } } __EventingCS.Unlock(); return hr; } ( that comment is mine, not MS' :rolleyes: ), Is it just me or is this code broken ? The only way this code is not broken is if there is some secret exception handling semantics going on which I don't know about. If that's the case I stand corrected. However, if it is not, then that piece of code will die somewhere bad due to a deadlock. Anyone ? cheers -=jarl=- ---------------------------- jarl ostensen Lead Technology Programmer Bullfrog/Electronic Arts Inc.

    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