outline

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Agent Mulder

    outline

    I feel the need for an outline specifier to
    facilitate java-style programming.



  • Victor Bazarov

    #2
    Re: outline

    "Agent Mulder" <mbmulder_remov e_this_@home.nl > wrote...[color=blue]
    > I feel the need for an outline specifier to
    > facilitate java-style programming.[/color]

    There is no need in the language to do anything to emulate
    any other language. What problem, otherwise unsolvable,
    will 'outline' solve? If you can answer this question, post
    your suggestion, with the justification, to comp.std.c++.

    Victor


    Comment

    • Andrey Tarasevich

      #3
      Re: outline

      Agent Mulder wrote:[color=blue]
      > I feel the need for an outline specifier to
      > facilitate java-style programming.
      > ...[/color]

      Don't you think that C++ already suffered enough from "java-style
      programming"? And that without even trying to facilitate it explicitly.

      --
      Best regards,
      Andrey Tarasevich
      Brainbench C and C++ Programming MVP

      Comment

      • Agent Mulder

        #4
        Re: outline

        AM> I feel the need for an outline specifier to
        AM> facilitate java-style programming.

        VB> There is no need in the language to do anything to emulate
        VB> any other language. What problem, otherwise unsolvable,
        VB> will 'outline' solve? If you can answer this question, post
        VB> your suggestion, with the justification, to comp.std.c++.

        With java-style programming I mean that you
        do away with the .cpp .h - pair of files. All
        function definitions go directly in the class
        declaration. The compiler honors this attempt
        and generates very fast, yet big applications.
        In order to slow my program down, I need some
        functions to be expanded 'outline'


        class Music
        {
        public:void init()
        {
        //1400 lines of initialization code (skipped)
        for(;;); //this forces my compiler to *NOT* inline this function
        }};


        This leaves me with a warning message:
        Warning W8027: Functions containing for are not expanded inline
        I wave my hat and shout back "Never Mind!". But why not write
        it like this:



        class Music
        {
        public:outline void init()
        {
        //1400 lines of initialization code (skipped)
        }};


        to make sure the compiler takes it out of the class
        definition while leaving the structure of the class intact.

        -X



        Comment

        • Peter van Merkerk

          #5
          Re: outline

          "Agent Mulder" <mbmulder_remov e_this_@home.nl > wrote:[color=blue]
          > I feel the need for an outline specifier to
          > facilitate java-style programming.[/color]

          Many compilers allow you to disable inlining of functions completely.
          There is a discussion going on in comp.lang.c++.m oderated (turn off
          inlining using extern "C") exactly about the same subject, you might
          want to join in there. I doubt that facilitating java-style programming
          will convince many, however.

          Just to satisfy my curiosity (not intended as criticism); if you prefer
          Java style programming, why you don't just use Java? I think one of the
          most important problems of Java programmers struggling to learn C++, is
          realizing that C++ is really a different programming language with
          different semantics and idioms, even though much of the syntax may seem
          quite familiar at first. Encouraging to make C++ look more like Java
          doesn't really help in this respect in my opinion

          --
          Peter van Merkerk
          peter.van.merke rk(at)dse.nl




          Comment

          • Victor Bazarov

            #6
            Re: outline

            "Agent Mulder" <mbmulder_remov e_this_@home.nl > wrote...[color=blue]
            > VB> Whatever.
            >
            >
            > That's not enough. [...][/color]

            Not enough for what? I don't want to continue this
            discussion.


            Comment

            • Agent Mulder

              #7
              Re: outline

              VB>I don't want to continue this discussion.


              Why not? I only want you to notice
              that I posted my suggestion for
              'outline' on July 29, 2003 and the
              suggestion for !inline by Francis
              Glassborrow is from July 31, 2003.
              Today! Only 2 hours ago, the e-ink
              has not yet dried...

              -X

              go expand a macro, or backtrace something...


              Comment

              • Karl Heinz Buchegger

                #8
                Re: outline



                Agent Mulder wrote:[color=blue]
                >
                > VB>I don't want to continue this discussion.
                >
                > Why not?[/color]

                I think Victor has the same feeling on this 'feature'
                as I have:
                It's pointless.
                If I don't want a function to be inlined, well, then
                simply don't write the function body in the class
                decleration. Plain and simple. No special keyword
                needed for that.

                --
                Karl Heinz Buchegger
                kbuchegg@gascad .at

                Comment

                • Agent Mulder

                  #9
                  Re: outline

                  KHB> I think Victor has the same feeling on this 'feature'
                  KHB> as I have:
                  KHB> It's pointless.
                  KHB> If I don't want a function to be inlined, well, then
                  KHB> simply don't write the function body in the class
                  KHB> decleration. Plain and simple. No special keyword
                  KHB> needed for that.

                  Modern compilers and linkers are smart enough
                  that they will inline everything they see fit, defined
                  inside or out of the class body. You can't trust on
                  that.

                  -X


                  Comment

                  • Karl Heinz Buchegger

                    #10
                    Re: outline



                    Agent Mulder wrote:[color=blue]
                    >
                    > KHB> I think Victor has the same feeling on this 'feature'
                    > KHB> as I have:
                    > KHB> It's pointless.
                    > KHB> If I don't want a function to be inlined, well, then
                    > KHB> simply don't write the function body in the class
                    > KHB> decleration. Plain and simple. No special keyword
                    > KHB> needed for that.
                    >
                    > Modern compilers and linkers are smart enough
                    > that they will inline everything they see fit, defined
                    > inside or out of the class body. You can't trust on
                    > that.
                    >[/color]

                    If the compiler deosn't see the source code,
                    it cannot inline it, simple.

                    But for the linker:
                    Do you know of any linker that does this?
                    I would be very surprised and make a deep bow
                    in front of the guys who managed to do that.

                    --
                    Karl Heinz Buchegger
                    kbuchegg@gascad .at

                    Comment

                    • Agent Mulder

                      #11
                      Re: outline

                      AM > I feel the need for an outline specifier [...]

                      KHB> If I don't want a function to be inlined, well, then
                      KHB> simply don't write the function body in the class
                      KHB> decleration. Plain and simple. No special keyword
                      KHB> needed for that.

                      AM> Modern compilers and linkers are smart enough
                      AM> that they will inline everything they see fit, defined
                      AM> inside or out of the class body.

                      KH> If the compiler deosn't see the source code,
                      KH> it cannot inline it, simple.
                      KH>
                      KH> But for the linker:
                      KH> Do you know of any linker that does this?
                      KH> I would be very surprised and make a deep bow
                      KH> in front of the guys who managed to do that.

                      I copied this reply from from the thread
                      Re: turn off inlining using extern "C", on
                      comp.lang.c++.m oderated:

                      Heinz Ozwirk:[color=blue]
                      >If you want to prevent functions from being inlined, put them in separate
                      >.cpp (or whatever) files and only include their prototypes in the code
                      >that calls them. The compiler cannot inline them, if it doesn't know what
                      >to inline.[/color]

                      Francis GlassBorow:
                      Of course it can and good linkers have been managing that for some time.
                      In future it will become more common as forms of semi-compiled code
                      become more common. VC++7 has some quite clever features in this area.

                      //Agent Mulder again:
                      The conclusion in that thread is that there is no
                      portable way to ensure that code gets expanded
                      outline (not inline). It is viewed as a de-optimization
                      enforced by the programmer. Your hack of taking
                      the function body out of the class declaration does
                      not work. Fix it.

                      -X


                      Comment

                      Working...