enabling unwind semantics

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Ambuhl

    #16
    Re: enabling unwind semantics

    v4vijayakumar wrote:[color=blue]
    > what "enabling unwind semantics" occording to Microsoft (R) 32-bit
    > C/C++ Optimizing Compiler.
    >
    > C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\os tream(574)
    > : warnin
    > g C4530: C++ exception handler used, but unwind semantics are not
    > enabled. Speci
    > fy /EHsc[/color]

    Questions about the C++ programming language should never be posted to
    <news:comp.lang .c>. Some of the folks at <news:comp.lang .c++> may offer
    you an answer, but they are misguided. Questions about
    implementation-specific details, such as yours, should go to a
    newsgroup, mailing list, or tech support for your implementation.
    Microsoft has provided several of these for you, nad there are others
    independent of MS. Use them.

    <news:comp.lang .c> removed from follow-ups. Perhaps the remaining
    newsgroup to which you posted should also be removed: I'll leave that to
    others.

    Comment

    • Larry I Smith

      #17
      Re: enabling unwind semantics

      v4vijayakumar wrote:[color=blue]
      > what "enabling unwind semantics" occording to Microsoft (R) 32-bit
      > C/C++ Optimizing Compiler.
      >
      > C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\os tream(574)
      > : warnin
      > g C4530: C++ exception handler used, but unwind semantics are not
      > enabled. Speci
      > fy /EHsc
      >[/color]

      The error message says it all...

      You are using C++ exceptions in your code, but by default,
      support for C++ exceptions is disabled in the compiler.
      As directed by the error message, you must add the

      /EHsc

      compiler option to your compile command line to tell the
      compiler to enable support for C++ exceptions.

      Larry

      Comment

      • Mark McIntyre

        #18
        Re: enabling unwind semantics

        On 3 May 2006 02:35:52 -0700, in comp.lang.c , "v4vijayaku mar"
        <v4vijayakumar@ yahoo.com> wrote:
        [color=blue]
        >Rolf Magnus wrote:
        >blah blah blah
        >
        >just wanted to know what "enabling unwind semantics" (may be related to
        >stack) means.[/color]

        Its some feature of your compiler. Did you read the documentation or
        search the maker's website?

        On second thoughts, why not ask in uk.lang.semanti cs, then insult
        people who suggest you ask in the right place?

        --
        Mark McIntyre

        "Debugging is twice as hard as writing the code in the first place.
        Therefore, if you write the code as cleverly as possible, you are,
        by definition, not smart enough to debug it."
        --Brian Kernighan

        Comment

        • Alf P. Steinbach

          #19
          Re: enabling unwind semantics

          * v4vijayakumar:[color=blue]
          > what "enabling unwind semantics" occording to Microsoft (R) 32-bit
          > C/C++ Optimizing Compiler.
          >
          > C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\os tream(574)
          > : warnin
          > g C4530: C++ exception handler used, but unwind semantics are not
          > enabled. Speci
          > fy /EHsc[/color]

          Microsoft's compiler, although one of the most standard-conforming when
          you provide appropriate switches, has completely non-standard behavior
          /by default/.

          By default you have (1) no exception handling, (2) no RTTI, (3) no
          wchar_t type, (4) non-standard scope for variables declared in for loops
          and while loops, (5) standard 'main' not supported for GUI program.

          Check the compiler's command line help info for appropriate switches;
          direct further questions to some Microsoft group.

          --
          A: Because it messes up the order in which people normally read text.
          Q: Why is it such a bad thing?
          A: Top-posting.
          Q: What is the most annoying thing on usenet and in e-mail?

          Comment

          • Gernot Frisch

            #20
            Re: enabling unwind semantics

            [color=blue]
            > By default you have (1) no exception handling, (2) no RTTI, (3) no
            > wchar_t type, (4) non-standard scope for variables declared in for
            > loops and while loops, (5) standard 'main' not supported for GUI
            > program.[/color]

            can you explain (4)?

            is that:
            for(int i=1; i; --i);
            {
            int me=i;
            }

            now - there's something wrong with 'me'?


            Comment

            • Alf P. Steinbach

              #21
              Re: enabling unwind semantics

              * Gernot Frisch:[color=blue][color=green]
              >> By default you have (1) no exception handling, (2) no RTTI, (3) no
              >> wchar_t type, (4) non-standard scope for variables declared in for
              >> loops and while loops, (5) standard 'main' not supported for GUI
              >> program.[/color]
              >
              > can you explain (4)?
              >
              > is that:
              > for(int i=1; i; --i);
              > {
              > int me=i;
              > }
              >
              > now - there's something wrong with 'me'?[/color]

              for(int i=1; i; --i);
              {
              }
              int me=i;

              Here there's "something wrong" with 'me'...

              A conforming compiler will not allow that.

              --
              A: Because it messes up the order in which people normally read text.
              Q: Why is it such a bad thing?
              A: Top-posting.
              Q: What is the most annoying thing on usenet and in e-mail?

              Comment

              • Ian Collins

                #22
                Re: enabling unwind semantics

                Alf P. Steinbach wrote:[color=blue]
                > * Gernot Frisch:
                >[color=green][color=darkred]
                >>> By default you have (1) no exception handling, (2) no RTTI, (3) no
                >>> wchar_t type, (4) non-standard scope for variables declared in for
                >>> loops and while loops, (5) standard 'main' not supported for GUI
                >>> program.[/color]
                >>
                >>
                >> can you explain (4)?
                >>
                >> is that:
                >> for(int i=1; i; --i);
                >> {
                >> int me=i;
                >> }
                >>
                >> now - there's something wrong with 'me'?[/color]
                >
                >
                > for(int i=1; i; --i);
                > {
                > }
                > int me=i;
                >
                > Here there's "something wrong" with 'me'...
                >
                > A conforming compiler will not allow that.
                >[/color]
                Best to drop comp.lang.c from this thread!

                --
                Ian Collins.

                Comment

                • Gernot Frisch

                  #23
                  Re: enabling unwind semantics

                  [color=blue][color=green]
                  >> for(int i=1; i; --i);
                  >> {
                  >> }
                  >> int me=i;
                  >>
                  >> Here there's "something wrong" with 'me'...
                  >>
                  >> A conforming compiler will not allow that.[/color][/color]


                  Ah. I think VC6 has this "feature". I don't like this. Really annoying
                  when you write:

                  for(int i=0;;)
                  {
                  }

                  for (int 0=;;)
                  {
                  }

                  and get an error! How can I turn this off?


                  Comment

                  • Ian Collins

                    #24
                    Re: enabling unwind semantics

                    Gernot Frisch wrote:[color=blue][color=green][color=darkred]
                    >>>for(int i=1; i; --i);
                    >>>{
                    >>>}
                    >>>int me=i;
                    >>>
                    >>>Here there's "something wrong" with 'me'...
                    >>>
                    >>>A conforming compiler will not allow that.[/color][/color]
                    >
                    >
                    >
                    > Ah. I think VC6 has this "feature". I don't like this. Really annoying
                    > when you write:
                    >
                    > for(int i=0;;)
                    > {
                    > }
                    >
                    > for (int 0=;;)
                    > {
                    > }
                    >
                    > and get an error! How can I turn this off?
                    >
                    >[/color]
                    You can't, VC6 is well known to be broken with respect to variable scope.

                    Time to upgrade and move on!

                    --
                    Ian Collins.

                    Comment

                    • Gernot Frisch

                      #25
                      Re: enabling unwind semantics

                      [color=blue]
                      > You can't, VC6 is well known to be broken with respect to variable
                      > scope.
                      >
                      > Time to upgrade and move on![/color]

                      I did, but I have to use it for one project, still (compatibility)


                      Comment

                      • Default User

                        #26
                        Re: enabling unwind semantics

                        Gernot Frisch wrote:
                        [color=blue]
                        >[color=green]
                        > > You can't, VC6 is well known to be broken with respect to variable
                        > > scope.
                        > >
                        > > Time to upgrade and move on![/color]
                        >
                        > I did, but I have to use it for one project, still (compatibility)[/color]

                        There's just not much you can do about it. If you need to have code
                        that is portable between VC6 and others then you have two options:

                        1. Use a different loop control variable name for each loop that's at
                        the same level:

                        for (int Index1 = 0; . . . )
                        for (int Index2 = 0; . . . )

                        2. Declare a common loop control variable in the enclosing block:

                        int Index;

                        for (Index = 0; . . . )
                        for (Index = 0; . . . )


                        Relying on the VC6 bug is a bad idea, as it breaks the code as soon as
                        you compile it elsewhere. The standard way breaks in VC6.




                        Brian

                        Comment

                        • Rolf Magnus

                          #27
                          Re: enabling unwind semantics

                          Default User wrote:
                          [color=blue]
                          > Gernot Frisch wrote:
                          >[color=green]
                          >>[color=darkred]
                          >> > You can't, VC6 is well known to be broken with respect to variable
                          >> > scope.
                          >> >
                          >> > Time to upgrade and move on![/color]
                          >>
                          >> I did, but I have to use it for one project, still (compatibility)[/color]
                          >
                          > There's just not much you can do about it. If you need to have code
                          > that is portable between VC6 and others then you have two options:
                          >
                          > 1. Use a different loop control variable name for each loop that's at
                          > the same level:
                          >
                          > for (int Index1 = 0; . . . )
                          > for (int Index2 = 0; . . . )
                          >
                          > 2. Declare a common loop control variable in the enclosing block:
                          >
                          > int Index;
                          >
                          > for (Index = 0; . . . )
                          > for (Index = 0; . . . )
                          >
                          >
                          > Relying on the VC6 bug is a bad idea, as it breaks the code as soon as
                          > you compile it elsewhere. The standard way breaks in VC6.[/color]

                          Well, there was that hack to make the standard way work with it, too. I
                          think it was something like:

                          #define for if (false); else for

                          Comment

                          • Marcus Kwok

                            #28
                            Re: enabling unwind semantics

                            Rolf Magnus <ramagnus@t-online.de> wrote:[color=blue]
                            > Default User wrote:[color=green]
                            >> There's just not much you can do about it. If you need to have code
                            >> that is portable between VC6 and others then you have two options:
                            >>
                            >> 1. Use a different loop control variable name for each loop that's at
                            >> the same level:
                            >>
                            >> for (int Index1 = 0; . . . )
                            >> for (int Index2 = 0; . . . )
                            >>
                            >> 2. Declare a common loop control variable in the enclosing block:
                            >>
                            >> int Index;
                            >>
                            >> for (Index = 0; . . . )
                            >> for (Index = 0; . . . )
                            >>
                            >>
                            >> Relying on the VC6 bug is a bad idea, as it breaks the code as soon as
                            >> you compile it elsewhere. The standard way breaks in VC6.[/color]
                            >
                            > Well, there was that hack to make the standard way work with it, too. I
                            > think it was something like:
                            >
                            > #define for if (false); else for[/color]

                            I believe another workaround was to enclose the entire 'for' loop in its
                            own block:


                            // stuff
                            {
                            for (int i = 0; . . . ) {
                            // do stuff in loop
                            }
                            }
                            // i is now out of scope here

                            --
                            Marcus Kwok
                            Replace 'invalid' with 'net' to reply

                            Comment

                            Working...