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. __try / __finally

__try / __finally

Scheduled Pinned Locked Moved C / C++ / MFC
c++hardwarehelpquestion
6 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.
  • I Offline
    I Offline
    IceBerG71
    wrote on last edited by
    #1

    Hi I know embedded Visual C++ compiler do not accept return statements in this __try and __finally. but i need to return different conditions(values) at different parts of the __try / __finally block, how shall i go about doing it? Need this help urgently. Thanx

    J 1 Reply Last reply
    0
    • I IceBerG71

      Hi I know embedded Visual C++ compiler do not accept return statements in this __try and __finally. but i need to return different conditions(values) at different parts of the __try / __finally block, how shall i go about doing it? Need this help urgently. Thanx

      J Offline
      J Offline
      jhwurmbach
      wrote on last edited by
      #2

      You should use the C++ RTTI. These old SEH is residual waste from a time when there was no support for RTTI in the VC++ compiler.


      Who is 'General Failure'? And why is he reading my harddisk?!?

      T I 2 Replies Last reply
      0
      • J jhwurmbach

        You should use the C++ RTTI. These old SEH is residual waste from a time when there was no support for RTTI in the VC++ compiler.


        Who is 'General Failure'? And why is he reading my harddisk?!?

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

        Structured exception handling and and C++ exception handling are two totally different things and are solutions to two different problems. RTTI is something else all together. In a C++ program try/catch is the way to go unless you are trying to catch OS exceptions such as access violations. For those cases you can use __try or use one of the many wrappers that will convert an SE to a C++ exception. Tim Smith I'm going to patent thought. I have yet to see any prior art.

        J 1 Reply Last reply
        0
        • T Tim Smith

          Structured exception handling and and C++ exception handling are two totally different things and are solutions to two different problems. RTTI is something else all together. In a C++ program try/catch is the way to go unless you are trying to catch OS exceptions such as access violations. For those cases you can use __try or use one of the many wrappers that will convert an SE to a C++ exception. Tim Smith I'm going to patent thought. I have yet to see any prior art.

          J Offline
          J Offline
          jhwurmbach
          wrote on last edited by
          #4

          Yes, my fault. RTTI has nothing to do with exceptions. It is switched on the same page of the VC6 configuration dialogues, though. :-) What you said and I meant is written in MSDN as follows:

          For C++ programs, it is recommended that you use the new C++ exception-handling mechanism
          (try, catch, and throw statements).


          Who is 'General Failure'? And why is he reading my harddisk?!?

          1 Reply Last reply
          0
          • J jhwurmbach

            You should use the C++ RTTI. These old SEH is residual waste from a time when there was no support for RTTI in the VC++ compiler.


            Who is 'General Failure'? And why is he reading my harddisk?!?

            I Offline
            I Offline
            IceBerG71
            wrote on last edited by
            #5

            Sorry, just to add in, i am using on embedded Visual C++, so that is why only __try and __except and __finally i can use.unless is using version 4, then i can use try and catch.. but that will have to recompile for a new window CE OS. i can do without __finally, then i can use return statement; but since __finally is a cleanup code, so i thought can use...make the codes cleaner also. so any suggestions? what is RTTI actually?

            J 1 Reply Last reply
            0
            • I IceBerG71

              Sorry, just to add in, i am using on embedded Visual C++, so that is why only __try and __except and __finally i can use.unless is using version 4, then i can use try and catch.. but that will have to recompile for a new window CE OS. i can do without __finally, then i can use return statement; but since __finally is a cleanup code, so i thought can use...make the codes cleaner also. so any suggestions? what is RTTI actually?

              J Offline
              J Offline
              jhwurmbach
              wrote on last edited by
              #6

              IceBerG71 wrote: what is RTTI actually? Run Time Type Information. It is the standard conformant way of determining a type at runtime. The same is done in MFC with things like IsKindOf(), but with this approach all objects need to have the same base class (CObject).


              Who is 'General Failure'? And why is he reading my harddisk?!?

              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