inline functions

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

    #1

    inline functions

    How do I write an inline function in c#? I've tried and looked at tutorials
    and other stuff but haven't been able to figure it out. if someone could
    give me a blank example, that would be very nice. thanks
    dave


  • Alvin Bruney

    #2
    Re: inline functions

    Keep the size under 32 or else just code it inline. as you go no say in this
    :D

    Microsoft knows better than you apparently :D


    "Dave" <davidhere40@ho tmail.com> wrote in message
    news:bcedndbJNv KQBCKiRVn-hA@comcast.com. ..[color=blue]
    > How do I write an inline function in c#? I've tried and looked at[/color]
    tutorials[color=blue]
    > and other stuff but haven't been able to figure it out. if someone could
    > give me a blank example, that would be very nice. thanks
    > dave
    >
    >[/color]


    Comment

    • Daniel O'Connell

      #3
      Re: inline functions

      What do you mean by an inline function?

      "Dave" <davidhere40@ho tmail.com> wrote in message
      news:bcedndbJNv KQBCKiRVn-hA@comcast.com. ..[color=blue]
      > How do I write an inline function in c#? I've tried and looked at[/color]
      tutorials[color=blue]
      > and other stuff but haven't been able to figure it out. if someone could
      > give me a blank example, that would be very nice. thanks
      > dave
      >
      >[/color]


      Comment

      • Dave

        #4
        Re: inline functions

        an in line function is a function that just holds code. and when you put it
        into your code, the compiler basically replaces the function call with the
        code in side the function.

        "Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in message
        news:ua9nP0RsDH A.1872@TK2MSFTN GP09.phx.gbl...[color=blue]
        > What do you mean by an inline function?
        >
        > "Dave" <davidhere40@ho tmail.com> wrote in message
        > news:bcedndbJNv KQBCKiRVn-hA@comcast.com. ..[color=green]
        > > How do I write an inline function in c#? I've tried and looked at[/color]
        > tutorials[color=green]
        > > and other stuff but haven't been able to figure it out. if someone could
        > > give me a blank example, that would be very nice. thanks
        > > dave
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Dave

          #5
          Re: inline functions

          so you're saying they don't exist in c#? I could copy and paste the function
          in like you said but I want to do it so many times and right after each
          other that I thought it would make things easier to just use an inline
          funciton many times. it would make it much easier to maintain as well. if
          you're wondering, its for a time consuming program that has a loop and I
          don't want to look after each call of the function, I need it to basically
          run the function inside of the loop a few times or so before the while is
          done again. just trust me that that's what I really want.
          thanks
          dave
          "Alvin Bruney" <alvin.bruney@t elia.com> wrote in message
          news:ezvHCzRsDH A.3224@tk2msftn gp13.phx.gbl...[color=blue]
          > Keep the size under 32 or else just code it inline. as you go no say in[/color]
          this[color=blue]
          > :D
          >
          > Microsoft knows better than you apparently :D
          >
          >
          > "Dave" <davidhere40@ho tmail.com> wrote in message
          > news:bcedndbJNv KQBCKiRVn-hA@comcast.com. ..[color=green]
          > > How do I write an inline function in c#? I've tried and looked at[/color]
          > tutorials[color=green]
          > > and other stuff but haven't been able to figure it out. if someone could
          > > give me a blank example, that would be very nice. thanks
          > > dave
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Daniel O'Connell

            #6
            Re: inline functions


            "Dave" <davidhere40@ho tmail.com> wrote in message
            news:duadnduBPI seAyKiRVn-sw@comcast.com. ..[color=blue]
            > so you're saying they don't exist in c#? I could copy and paste the[/color]
            function[color=blue]
            > in like you said but I want to do it so many times and right after each
            > other that I thought it would make things easier to just use an inline
            > funciton many times. it would make it much easier to maintain as well. if
            > you're wondering, its for a time consuming program that has a loop and I
            > don't want to look after each call of the function, I need it to basically
            > run the function inside of the loop a few times or so before the while is
            > done again. just trust me that that's what I really want.
            > thanks[/color]

            Well, that is both inlining AND loop unrolling. I imagine the JIT does some
            loop unrolling, and I know it inlines, but it is up to the JITer, not the
            coder to determine that.
            [color=blue]
            > dave
            > "Alvin Bruney" <alvin.bruney@t elia.com> wrote in message
            > news:ezvHCzRsDH A.3224@tk2msftn gp13.phx.gbl...[color=green]
            > > Keep the size under 32 or else just code it inline. as you go no say in[/color]
            > this[color=green]
            > > :D
            > >
            > > Microsoft knows better than you apparently :D
            > >
            > >
            > > "Dave" <davidhere40@ho tmail.com> wrote in message
            > > news:bcedndbJNv KQBCKiRVn-hA@comcast.com. ..[color=darkred]
            > > > How do I write an inline function in c#? I've tried and looked at[/color]
            > > tutorials[color=darkred]
            > > > and other stuff but haven't been able to figure it out. if someone[/color][/color][/color]
            could[color=blue][color=green][color=darkred]
            > > > give me a blank example, that would be very nice. thanks
            > > > dave
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Paul Robson

              #7
              Re: inline functions

              Dave wrote:
              [color=blue]
              > so you're saying they don't exist in c#?[/color]

              No, but you can't force them by declaring a function __inline or
              whatever. It's dependent on the function size.

              Comment

              • Michael Mayer

                #8
                Re: inline functions

                "Alvin Bruney" <alvin.bruney@t elia.com> wrote in message
                news:ezvHCzRsDH A.3224@tk2msftn gp13.phx.gbl...[color=blue]
                > Keep the size under 32 or else just code it inline. as you go no say in[/color]
                this[color=blue]
                > :D
                >
                > Microsoft knows better than you apparently :D[/color]

                I don't speak for Microsoft, but I would expect that the JIT compiler would
                know better than you (or would have the capability to know as it matures)
                when inlining would help vs. when it would hurt. Even in C++, most compilers
                are free to ignore the inline keyword and do whatever they think is best
                anyway.

                I found this page to be an interesting overview of some issues associated
                with inline functions.


                And in today's age of rapid-development languages, I'm thankful to not have
                to worry about those issues as I try to decide what to inline.

                Mike


                Comment

                • Alvin Bruney

                  #9
                  Re: inline functions

                  The JIT has no fuckin clue what my situation is has it, it has no fuckin
                  clue how I ME MOI want MY program to run.


                  "Michael Mayer" <mike@mag37.com > wrote in message
                  news:uX7J1qSsDH A.2408@tk2msftn gp13.phx.gbl...[color=blue]
                  > "Alvin Bruney" <alvin.bruney@t elia.com> wrote in message
                  > news:ezvHCzRsDH A.3224@tk2msftn gp13.phx.gbl...[color=green]
                  > > Keep the size under 32 or else just code it inline. as you go no say in[/color]
                  > this[color=green]
                  > > :D
                  > >
                  > > Microsoft knows better than you apparently :D[/color]
                  >
                  > I don't speak for Microsoft, but I would expect that the JIT compiler[/color]
                  would[color=blue]
                  > know better than you (or would have the capability to know as it matures)
                  > when inlining would help vs. when it would hurt. Even in C++, most[/color]
                  compilers[color=blue]
                  > are free to ignore the inline keyword and do whatever they think is best
                  > anyway.
                  >
                  > I found this page to be an interesting overview of some issues associated
                  > with inline functions.
                  > http://www.parashift.com/c++-faq-lit...functions.html
                  >
                  > And in today's age of rapid-development languages, I'm thankful to not[/color]
                  have[color=blue]
                  > to worry about those issues as I try to decide what to inline.
                  >
                  > Mike
                  >
                  >[/color]


                  Comment

                  • Richard A. Lowe

                    #10
                    Re: inline functions

                    You could probably write a medium-complexity VS.NET macro to do it, then
                    just run that macro in the build event of your project. In the world of C#
                    inlining per se is the domain of the JIT compiler, as others have mentioned.

                    Richard

                    --
                    Veuillez m'excuser, mon Français est très pauvre. Cependant, si vous voyez
                    mauvais C #, c'est mon défaut!
                    "Dave" <davidhere40@ho tmail.com> wrote in message
                    news:duadnduBPI seAyKiRVn-sw@comcast.com. ..[color=blue]
                    > so you're saying they don't exist in c#? I could copy and paste the[/color]
                    function[color=blue]
                    > in like you said but I want to do it so many times and right after each
                    > other that I thought it would make things easier to just use an inline
                    > funciton many times. it would make it much easier to maintain as well. if
                    > you're wondering, its for a time consuming program that has a loop and I
                    > don't want to look after each call of the function, I need it to basically
                    > run the function inside of the loop a few times or so before the while is
                    > done again. just trust me that that's what I really want.
                    > thanks
                    > dave
                    > "Alvin Bruney" <alvin.bruney@t elia.com> wrote in message
                    > news:ezvHCzRsDH A.3224@tk2msftn gp13.phx.gbl...[color=green]
                    > > Keep the size under 32 or else just code it inline. as you go no say in[/color]
                    > this[color=green]
                    > > :D
                    > >
                    > > Microsoft knows better than you apparently :D
                    > >
                    > >
                    > > "Dave" <davidhere40@ho tmail.com> wrote in message
                    > > news:bcedndbJNv KQBCKiRVn-hA@comcast.com. ..[color=darkred]
                    > > > How do I write an inline function in c#? I've tried and looked at[/color]
                    > > tutorials[color=darkred]
                    > > > and other stuff but haven't been able to figure it out. if someone[/color][/color][/color]
                    could[color=blue][color=green][color=darkred]
                    > > > give me a blank example, that would be very nice. thanks
                    > > > dave
                    > > >
                    > > >[/color]
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    • Dave

                      #11
                      Re: inline functions



                      "Alvin Bruney" <alvin.bruney@t elia.com> wrote in message
                      news:O7JrPNTsDH A.3196@TK2MSFTN GP11.phx.gbl...[color=blue]
                      > The JIT has no fuckin clue what my situation is has it, it has no fuckin
                      > clue how I ME MOI want MY program to run.
                      >
                      >
                      > "Michael Mayer" <mike@mag37.com > wrote in message
                      > news:uX7J1qSsDH A.2408@tk2msftn gp13.phx.gbl...[color=green]
                      > > "Alvin Bruney" <alvin.bruney@t elia.com> wrote in message
                      > > news:ezvHCzRsDH A.3224@tk2msftn gp13.phx.gbl...[color=darkred]
                      > > > Keep the size under 32 or else just code it inline. as you go no say[/color][/color][/color]
                      in[color=blue][color=green]
                      > > this[color=darkred]
                      > > > :D
                      > > >
                      > > > Microsoft knows better than you apparently :D[/color]
                      > >
                      > > I don't speak for Microsoft, but I would expect that the JIT compiler[/color]
                      > would[color=green]
                      > > know better than you (or would have the capability to know as it[/color][/color]
                      matures)[color=blue][color=green]
                      > > when inlining would help vs. when it would hurt. Even in C++, most[/color]
                      > compilers[color=green]
                      > > are free to ignore the inline keyword and do whatever they think is best
                      > > anyway.
                      > >
                      > > I found this page to be an interesting overview of some issues[/color][/color]
                      associated[color=blue][color=green]
                      > > with inline functions.
                      > > http://www.parashift.com/c++-faq-lit...functions.html
                      > >
                      > > And in today's age of rapid-development languages, I'm thankful to not[/color]
                      > have[color=green]
                      > > to worry about those issues as I try to decide what to inline.
                      > >
                      > > Mike
                      > >
                      > >[/color]
                      >
                      >[/color]


                      ok..... chill pill?


                      Comment

                      Working...