code portability

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

    #121
    Re: code portability

    Richard Heathfield posted:
    Keith Thompson said:
    >
    >Frederick Gotham <fgothamNO@SPAM .comwrites:
    >>>
    >>I like my style though.
    >>
    >Ok. What about anyone else who reads your code?
    >
    If you don't like it, don't read it.
    >
    I don't like it, so I won't read it.
    >
    But how he writes his code is up to him. If he doesn't need other people
    to read it (e.g. to help him out), then as long as he can read it,
    that's all that matters.
    <OFF-TOPIC>
    I started my new style of definitions when I delved deep into template
    programming in C++. Some of my definitions were three lines long (when
    word-wrapped), and so I separated the lines like as follows:

    export template<class NumT, class StrT>
    typename Assum<NumT,StrT >::CharT const
    *Assum<NumT,Str T>::TextProcess (Letters<NumTco nst &stls)

    It's a lot clearer to me like that.

    It made sense to overhaul my entire style once I'd seen the light.
    </OFF-TOPIC>

    --

    Frederick Gotham

    Comment

    • Ian Collins

      #122
      Re: code portability

      Frederick Gotham wrote:
      Al Balmer posted:
      >
      >
      >>>Perhaps you'd like to post some of your own code, and I'll point out the
      >>>flaws?
      >>
      >>I wouldn't bother, since you and I obviously have very different ideas
      >>as to what constitutes good code.
      >>
      >>I'll just say that if you presented the examples you've shown in a
      >>code review here, you'd be told to fix them.
      >
      >
      >
      Who said anything about a code review? My programming doesn't undergo a
      "code review", and so I don't have to dumb it down and suck the efficiency
      out of it to satisfy the politics of whomever I work for.
      >
      What a load of twaddle.

      Are you claiming

      static inline int Func(...

      is less efficient than

      int inline static Func(...

      Which was the style issue under discussion.
      >
      God forbid they might actually adopt my style.
      >
      +1 to that.

      --
      Ian Collins.

      Comment

      • Keith Thompson

        #123
        Re: code portability

        Richard Heathfield <invalid@invali d.invalidwrites :
        Keith Thompson said:
        >Frederick Gotham <fgothamNO@SPAM .comwrites:
        >>I like my style though.
        >>
        >Ok. What about anyone else who reads your code?
        >
        If you don't like it, don't read it.
        >
        I don't like it, so I won't read it.
        >
        But how he writes his code is up to him. If he doesn't need other people to
        read it (e.g. to help him out), then as long as he can read it, that's all
        that matters.
        Absolutely. But he's shooting himself in the foot, and I have some
        vague hope that I might be able to help him realize that.

        --
        Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
        San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
        We must do something. This is something. Therefore, we must do this.

        Comment

        • Flash Gordon

          #124
          Re: code portability

          Frederick Gotham wrote:
          Al Balmer posted:
          >
          >>Perhaps you'd like to post some of your own code, and I'll point out the
          >>flaws?
          >I wouldn't bother, since you and I obviously have very different ideas
          >as to what constitutes good code.
          >>
          >I'll just say that if you presented the examples you've shown in a
          >code review here, you'd be told to fix them.
          >
          Who said anything about a code review? My programming doesn't undergo a
          "code review", and so I don't have to dumb it down and suck the efficiency
          out of it to satisfy the politics of whomever I work for.
          Of the code I have completely rejected at review:
          Some was reused and failed exactly as I said it would. I actually
          rejected it before the review, then someone else reviewed it and
          let it through.

          Some I rewrote and the original author agreed my rewrite was better.

          Code reviews do not mean the code has to be dumbed down. They are about
          ensuring quality.
          >If the second review wasn't drastically improved, there wouldn't be a
          >third.
          >
          If my second try was 40% less efficient the second time around, would it
          make the cut?
          Where I used to work someone would sit down with you and rewrite it to
          be correct, maintainable, conforming to our standard and reasonably
          efficient. Of course, we would only expect to do this with someone still
          learning to program and it would be quietly suggested to the technical
          authority on the project that s/he should spend more time with this
          person obviously still in need of lots of training.
          >So, do your own thing, but I hope no one else ever has to deal with
          >it.
          >
          God forbid they might actually adopt my style.
          Why should they when for so many the more common style reads more easily?
          --
          Flash Gordon
          Still sigless on this computer.

          Comment

          • Frederick Gotham

            #125
            Re: code portability

            Ian Collins posted:
            >Who said anything about a code review? My programming doesn't undergo a
            >"code review", and so I don't have to dumb it down and suck the
            >efficiency out of it to satisfy the politics of whomever I work for.
            >>
            What a load of twaddle.
            >
            Are you claiming
            >
            static inline int Func(...
            >
            is less efficient than
            >
            int inline static Func(...
            >
            Which was the style issue under discussion.

            No, I was referring to how people who work as programmers tend to suck all
            the efficiency out of their code so that it will pass a code review.

            --

            Frederick Gotham

            Comment

            • Ian Collins

              #126
              Re: code portability

              Frederick Gotham wrote:
              Ian Collins posted:
              >
              >
              >>>Who said anything about a code review? My programming doesn't undergo a
              >>>"code review", and so I don't have to dumb it down and suck the
              >>>efficiency out of it to satisfy the politics of whomever I work for.
              >>>
              >>
              >>What a load of twaddle.
              >>
              >>Are you claiming
              >>
              > static inline int Func(...
              >>
              >>is less efficient than
              >>
              > int inline static Func(...
              >>
              >>Which was the style issue under discussion.
              >
              >
              >
              No, I was referring to how people who work as programmers tend to suck all
              the efficiency out of their code so that it will pass a code review.
              >
              Not in my shop.

              --
              Ian Collins.

              Comment

              • Ian Collins

                #127
                Re: code portability

                Ian Collins wrote:
                >
                Not in my shop.
                >
                I forgot to say we don't do code reviews.

                --
                Ian Collins.

                Comment

                • Stephen Sprunk

                  #128
                  Re: code portability

                  "Frederick Gotham" <fgothamNO@SPAM .comwrote in message
                  news:4Z6Cg.1241 1$j7.321463@new s.indigo.ie...
                  Ian Collins posted:
                  >>Who said anything about a code review? My programming doesn't
                  >>undergo a "code review", and so I don't have to dumb it down and
                  >>suck the efficiency out of it to satisfy the politics of whomever
                  >>I
                  >>work for.
                  >>
                  >What a load of twaddle.
                  ....
                  No, I was referring to how people who work as programmers tend to
                  suck all the efficiency out of their code so that it will pass a
                  code
                  review.
                  Efficiency only matters after you've established correctness. If I
                  can't determine if your code is correct, it fails. If it is correct
                  and the lack of clarity has measurable positive effects on efficiency,
                  then I'd pass it as long as it was commented well enough that another
                  coder would be able to maintain it later.

                  However, most "efficiency " claims I've seen to justify bad code are
                  not only unjustified (it has no positive effect on performance), but
                  they often tend to be _wrong_ as well, as the "efficient" coder has
                  managed to (a) rely on non-portable assumptions that will break when
                  the code is ported or under various edge cases, or (b) confuse the
                  compiler enough that the code is actually slower than a clearer
                  idiomatic implementation.

                  S

                  --
                  Stephen Sprunk "God does not play dice." --Albert Einstein
                  CCIE #3723 "God is an inveterate gambler, and He throws the
                  K5SSS dice at every possible opportunity." --Stephen Hawking



                  --
                  Posted via a free Usenet account from http://www.teranews.com

                  Comment

                  • Richard Heathfield

                    #129
                    Re: code portability

                    Keith Thompson said:
                    Richard Heathfield <invalid@invali d.invalidwrites :
                    >Keith Thompson said:
                    >>Frederick Gotham <fgothamNO@SPAM .comwrites:
                    >>>I like my style though.
                    >>>
                    >>Ok. What about anyone else who reads your code?
                    >>
                    >If you don't like it, don't read it.
                    >>
                    >I don't like it, so I won't read it.
                    >>
                    >But how he writes his code is up to him. If he doesn't need other people
                    >to read it (e.g. to help him out), then as long as he can read it, that's
                    >all that matters.
                    >
                    Absolutely. But he's shooting himself in the foot, and I have some
                    vague hope that I might be able to help him realize that.
                    He doesn't strike me as a learner, somehow. Let's hope we're wrong.

                    --
                    Richard Heathfield
                    "Usenet is a strange place" - dmr 29/7/1999

                    email: rjh at above domain (but drop the www, obviously)

                    Comment

                    • Al Balmer

                      #130
                      Re: code portability

                      On Tue, 08 Aug 2006 21:01:52 GMT, Frederick Gotham
                      <fgothamNO@SPAM .comwrote:
                      >Ian Collins posted:
                      >
                      >>Who said anything about a code review? My programming doesn't undergo a
                      >>"code review", and so I don't have to dumb it down and suck the
                      >>efficiency out of it to satisfy the politics of whomever I work for.
                      So, you're an amateur, coding strictly for your own ends. OK, that's
                      fine.
                      >>>
                      >What a load of twaddle.
                      >>
                      >Are you claiming
                      >>
                      > static inline int Func(...
                      >>
                      >is less efficient than
                      >>
                      > int inline static Func(...
                      >>
                      >Which was the style issue under discussion.
                      >
                      >
                      >No, I was referring to how people who work as programmers tend to suck all
                      >the efficiency out of their code so that it will pass a code review.
                      Now, just how would you know that, since you have no truck with code
                      reviews? In any case, it's just one more thing you "know" that isn't
                      true.

                      --
                      Al Balmer
                      Sun City, AZ

                      Comment

                      • Al Balmer

                        #131
                        Re: code portability

                        On Wed, 09 Aug 2006 09:27:49 +1200, Ian Collins <ian-news@hotmail.co m>
                        wrote:
                        >Ian Collins wrote:
                        >>
                        >Not in my shop.
                        >>
                        >I forgot to say we don't do code reviews.
                        Nor do we, on a routine basis. We do code reviews for new hires until
                        we gain confidence in them. That's partly a job review and partly
                        training, and very much to insure correctness and maintainability . In
                        addition, programmers review each other's code on request.

                        --
                        Al Balmer
                        Sun City, AZ

                        Comment

                        • Dik T. Winter

                          #132
                          Re: code portability

                          In article <HMqdnXjNK5zfOE XZRVnyrg@bt.cominvalid@invalid .invalid writes:
                          Racaille said:
                          >
                          Richard Heathfield wrote:
                          char 8 bits
                          short 64 bits
                          int 64 bits
                          long 64 bits
                          >
                          and at least one implementation does it like that.
                          which one ?
                          >
                          One of the Cray implementations . I forget which one. Nexus rings a bell, but
                          I wouldn't swear to it.
                          If I remember correctly, the standard compiler was switchable with
                          respect to the size of short, either 64 bits or 32 bits.
                          --
                          dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
                          home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/

                          Comment

                          • Frederick Gotham

                            #133
                            Re: code portability

                            Al Balmer posted:
                            >>>Who said anything about a code review? My programming doesn't undergo
                            >>>a "code review", and so I don't have to dumb it down and suck the
                            >>>efficiency out of it to satisfy the politics of whomever I work for.
                            >
                            So, you're an amateur, coding strictly for your own ends. OK, that's
                            fine.

                            This newsgroup is comp.lang.c, not comp.lang.c.bus iness.

                            I am predominantly a C++ programmer, however I can program in C.

                            My own code does not suffer from any restrictions which a company may
                            impose, and so I strive to write quality, fully-portable, Standard-
                            compliant, efficient code.

                            I am not the best C++ programmer in the world, nor am I the best C
                            programmer in the world; however I feel that I am up there with the best.
                            Perhaps I'm in the top 5% maybe?

                            I visit newsgroups for hours each day because I want to be a brilliant
                            programmer. My aspiration has nothing to do with money, nothing to do with
                            career, and everything to do with passion. Funny as it may sound, (and as
                            unhealthy as it may sound), computers are a fundamental part of my life.
                            From childhood, while most kids were playing with batman toys, I was busy
                            writing batch files. I can remember how great I felt when, at the age of
                            about 8, I wrote a batch file to allow the user to select their startup; I
                            gave them a choice of command prompt, or Windows, or Norton Commander. I
                            spent day after day learning the in's and out's of "config.sys " and
                            "autoexec.b at". I can recall the joy I had experimenting with "ansi.sys",
                            making colourful command prompts and so forth...

                            My interest in computers progressed over the years, and I took up
                            programming in the form of Visual Basic at the age of about 12. From there,
                            I moved on to C++. After a few years of programming in C++, I became
                            complacent with "high level" programming, and wanted to get back to some
                            *real* programming. That's why I post on comp.lang.c.

                            Posting here, and over on comp.lang.c++, I am disconcerted by the ever-
                            frequent mention of business. I would have thought that programmers would
                            be passionate about what they do, and that they would turn their back on
                            any prospect of perverting or dumbing down their programming to satisfy the
                            man in the suit. At the moment, it seems that I'm in the minority here, and
                            so be it. Thankfully though, twenty years down the road, still shy of
                            forty, I forsee myself as being a programmer of the highest proficiency. If
                            there's anything I can learn from these newsgroups, it's that I never want
                            to program as an occupation.

                            In the future, I think I would take great satisfaction from teaching
                            programming, and concurrently working voluntarily on a Standard's
                            Committee.

                            --

                            Frederick Gotham

                            Comment

                            • Ian Collins

                              #134
                              Re: code portability

                              Frederick Gotham wrote:
                              >
                              I am predominantly a C++ programmer, however I can program in C.
                              >
                              My own code does not suffer from any restrictions which a company may
                              impose, and so I strive to write quality, fully-portable, Standard-
                              compliant, efficient code.
                              >
                              Commendable objectives.

                              It may not be popular in these parts, but I'd recommend you become
                              familiar with Test Driven Development as a way of enhancing the quality
                              of your code, both in design and implementation.

                              Don't just concentrate on the details of coding, keep an open mind and
                              investigate alternative ways of producing code.
                              >
                              Posting here, and over on comp.lang.c++, I am disconcerted by the ever-
                              frequent mention of business. I would have thought that programmers would
                              be passionate about what they do, and that they would turn their back on
                              any prospect of perverting or dumbing down their programming to satisfy the
                              man in the suit. At the moment, it seems that I'm in the minority here, and
                              so be it.
                              Unfortunately that's the real world we professional programmers inhabit,
                              although I've never had to, or in recent years required my staff to
                              "dumb down" programming. I'm not sure from where or on what basis you
                              make that observation.
                              Thankfully though, twenty years down the road, still shy of
                              forty, I forsee myself as being a programmer of the highest proficiency. If
                              there's anything I can learn from these newsgroups, it's that I never want
                              to program as an occupation.
                              >
                              Then broaden you horizons, learn as many languages and methodologies as
                              you can, over time you will find the path that works best for you.

                              --
                              Ian Collins.

                              Comment

                              • Keith Thompson

                                #135
                                Re: code portability

                                Frederick Gotham <fgothamNO@SPAM .comwrites:
                                Al Balmer posted:
                                >>>>Who said anything about a code review? My programming doesn't undergo
                                >>>>a "code review", and so I don't have to dumb it down and suck the
                                >>>>efficienc y out of it to satisfy the politics of whomever I work for.
                                >>
                                >So, you're an amateur, coding strictly for your own ends. OK, that's
                                >fine.
                                >
                                This newsgroup is comp.lang.c, not comp.lang.c.bus iness.
                                [snip]
                                I visit newsgroups for hours each day because I want to be a brilliant
                                programmer.
                                [snip]
                                In the future, I think I would take great satisfaction from teaching
                                programming, and concurrently working voluntarily on a Standard's
                                Committee.
                                Ok, you want to be the best C (<OT>and/or C++</OT>) programmer you can
                                be. That's terrific, and I say that without a trace of sarcasm.

                                What I don't understand is how this quest leads you to declare things
                                backwards, using "int unsigned" rather than the far more common
                                "unsigned int". (Note that even in English grammar, "unsigned int"
                                makes more sense; "unsigned" is an adjective, and "int" is a noun --
                                not that that's a decisive argument.)

                                You've invented a set of rules for how you order keywords, taking
                                advantage of the fact that the compiler doesn't care. The result is
                                difficult to read for 99% of C programmers. It's not impossible to
                                read, just annoyingly difficult, and for no benefit that I can see.

                                For myself, it makes me less inclined to spend any time reading
                                articles you post if they use your unconventional ordering. You're
                                not programming in a vacuum, you're participating in this newsgroup,
                                and you are, as Henry Spencer wrote, "creating beautiful new
                                impediments to understanding".

                                If there were some real benefit, I wouldn't be complaining.

                                --
                                Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
                                San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
                                We must do something. This is something. Therefore, we must do this.

                                Comment

                                Working...