Compilers that do implement C++ Exception Specifications

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philipp Holzschneider

    Compilers that do implement C++ Exception Specifications

    Are there any available c++ compilers around that strictly
    implement the mentioned "Exception Specification"
    feature??


    where the following compiles
    void func() { throw A(); };
    void gunc() throw(A,B) { throw A(); };
    ----
    void thrower() throw(A) { throw A(); };
    void passer() throw(A) { thrower(); };
    void catcher() throw() { try { passer() } catch ( A ) {}; };


    while this would not compile
    void func() throw() { throw A(); };
    void gunc() throw(C,D) { throw A(); };
    ----
    void thrower() throw(A) { throw A(); };
    void passer() throw(B) { thrower(); };
    void catcher() throw() { passer(); };


    thx in advance!
    --------------------------
    Philipp Holzschneider
    Rotobee Realtime 3D GmbH
    --------------------------



  • Ron Natalie

    #2
    Re: Compilers that do implement C++ Exception Specifications


    "Philipp Holzschneider" <holzschneider@ rotobee.com> wrote in message news:blf94r$ro0 $1@news.eusc.in ter.net...[color=blue]
    > Are there any available c++ compilers around that strictly
    > implement the mentioned "Exception Specification"
    > feature??[/color]

    Not that I know of. If it would, it would be a violation of the standard. All
    an exception specification does is block exceptions from propagating, it
    doesn't mean that the code within can't be allowed to throw the disallowed
    exceptions.


    Comment

    • tom_usenet

      #3
      Re: Compilers that do implement C++ Exception Specifications

      On Wed, 1 Oct 2003 21:24:47 +0200, "Philipp Holzschneider"
      <holzschneider@ rotobee.com> wrote:
      [color=blue]
      >Are there any available c++ compilers around that strictly
      >implement the mentioned "Exception Specification"
      >feature??
      >
      >
      > where the following compiles
      >void func() { throw A(); };
      >void gunc() throw(A,B) { throw A(); };
      >----
      >void thrower() throw(A) { throw A(); };
      >void passer() throw(A) { thrower(); };
      >void catcher() throw() { try { passer() } catch ( A ) {}; };
      >
      >
      > while this would not compile
      >void func() throw() { throw A(); };
      >void gunc() throw(C,D) { throw A(); };
      >----
      >void thrower() throw(A) { throw A(); };
      >void passer() throw(B) { thrower(); };
      >void catcher() throw() { passer(); };[/color]

      A standard compiler is expected to compile the above code, and call
      std::unexpected _exception if an unexpected exception escapes a
      function. Some idioms rely on this. Exception specifications are an
      entirely runtime feature. They aren't checked at compile time.

      Tom

      Comment

      • Philipp Holzschneider

        #4
        Re: Compilers that do implement C++ Exception Specifications

        > > [codesamples][color=blue]
        > A standard compiler is expected to compile the above code, and call
        > std::unexpected _exception if an unexpected exception escapes a
        > function. Some idioms rely on this. Exception specifications are an
        > entirely runtime feature. They aren't checked at compile time.[/color]

        that really sucks :/ i found that out myself recently

        why arent exception specifications "compile time type safety for excpt
        handling" as it is in (glorious beloved sweet) java? i dont see any reasons
        for not beeing able to implement that in future C++ -compilers :(
        the only advantage for handling that at runtime would be not to restrict
        method invocations by ex-specs, since it is assumed not to throw an
        exception anyways (under normal circumstances), so that the application
        code isnt forcely filled with exception handling code.

        but lotsa "modern" code or should i say, code that i love, uses non
        severe exception handling for common controlpaths, and that kinda
        codingstyle is perfectly guided by javastyle exceptionspecs and related
        features.

        phil





        PS-OT: anybody out there, who'sp*ssed by oldskool C++ freedom /
        doing-by-foot-suffers and wishes to implement some sort of managed C++.Org
        language that comes with all the beloved features from java(1.5) while still
        retaining C++ stack-located-complex-basictype power (?)
        and moreover compiles into java bytecode that is perfectly executed by
        every common JRE and compatible to all other java bytecode?????
        if so, pm me!!

        --------------------------
        Philipp Holzschneider
        Rotobee Realtime 3D GmbH
        --------------------------


        Comment

        • Kevin Goodsell

          #5
          Re: Compilers that do implement C++ Exception Specifications

          tom_usenet wrote:
          [color=blue]
          >
          > A standard compiler is expected to compile the above code, and call
          > std::unexpected _exception if an unexpected exception escapes a
          > function. Some idioms rely on this. Exception specifications are an
          > entirely runtime feature. They aren't checked at compile time.[/color]

          It calls std::unexpected (), not std::unexpected _exception.

          -Kevin
          --
          My email address is valid, but changes periodically.
          To contact me please use the address from a recent posting.

          Comment

          • WW

            #6
            Re: Compilers that do implement C++ Exception Specifications

            Philipp Holzschneider wrote:
            [SNIP][color=blue]
            > PS-OT: anybody out there, who'sp*ssed by oldskool C++ freedom /
            > doing-by-foot-suffers and wishes to implement some sort of managed
            > C++.Org language that comes with all the beloved features from
            > java(1.5) while still retaining C++ stack-located-complex-basictype
            > power (?)
            > and moreover compiles into java bytecode that is perfectly executed by
            > every common JRE and compatible to all other java bytecode?????
            > if so, pm me!![/color]

            Look at D and all the discussion about it in comp.lang.c++.m oderated. If I
            understand what you want, you will like it.

            --
            WW aka Attila


            Comment

            • Ron Natalie

              #7
              Re: Compilers that do implement C++ Exception Specifications


              "Philipp Holzschneider" <holzschneider@ rotobee.com> wrote in message news:blhoo1$4mt $1@news.eusc.in ter.net...
              [color=blue]
              >
              > but lotsa "modern" code or should i say, code that i love, uses non
              > severe exception handling for common controlpaths, and that kinda
              > codingstyle is perfectly guided by javastyle exceptionspecs and related
              > features.
              >[/color]
              Unfortunately by impelementing the "weak" exceptio specifications, any strengthening
              of the requirements will break any existing progams that use them at all.


              Comment

              Working...