code portability

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

    Re: code portability


    "Frederick Gotham" <fgothamNO@SPAM .comwrote in message
    news:O81Cg.1238 4$j7.321440@new s.indigo.ie...
    Philip Potter posted:
    >
    >It's almost always better to stick with a coding style that you perceive
    >as flawed but which everyone is used to, than to use your own style
    >which (despite any advantage it may offer) nobody is used to and so
    >nobody can read.
    >
    >
    If you're going to be reading other people's code, you need to be used to
    variety.
    >
    If part of your job is reading other people's code, then you should be
    good
    at it. It takes less than an hour to get used to different word orderings:
    >
    int const *p;
    >
    const int *p;
    >
    static inline int Func(...
    >
    int inline static Func(...
    >
    inline static int Func(...
    >
    static int inline Func(...
    >
    The people who are arguing that "other people should be able to read your
    code" are the very people who have difficulty reading other people's code.
    Big deal: I write "char unsigned" instead of "unsigned char"... is it
    really that bewildering?
    Man I don't know where you work, but every single programmer I manage on my
    system codes by the methods outlined by the customer - NOT what they feel is
    appropriate. If the customer wants his int variables to be named using some
    arcane mathematical formula then so be it, if they want the int variables to
    be a,b,c,d,e,f,... then so be it. The coding standard is determined by the
    project and the customer, never the coder - at least in my realm.
    >
    At then end of the day, if you have a problem with:
    >
    char unsigned const static inline (*const Func(void))[3]
    >
    , then you should take it up with the Standards Commitee -- because right
    now, it's perfectly legal, and I like it. (And please don't come back with
    an argument such as the following is legal:
    >
    #define void int
    #define main core
    #define start {
    #define end }
    >
    void core()
    start
    return 0;
    end
    >
    --
    >
    Frederick Gotham

    Comment

    • J. J. Farrell

      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.
      Why should a code review result in dumbing down or reduction of
      efficiency? I've never known a code review do either of these things;
      more often just the opposite.
      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?
      Definitely not. You'd have to correct what you'd screwed up since the
      first review as well as correcting what was brought up the first time.
      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.
      Well prayed, sir; I sincerely hope he does.

      Comment

      • ena8t8si@yahoo.com

        Re: code portability


        Frederick Gotham wrote:
        Al Balmer posted:
        >
        First, you have to get up to their level, then you can start improving
        things.
        >
        >
        Perhaps you'd like to post some of your own code, and I'll point out the
        flaws?
        I suspect most potential responders believe your comments wouldn't
        have enough value to be worth the effort of posting.

        Comment

        • ena8t8si@yahoo.com

          Re: code portability


          Keith Thompson wrote:
          How do you feel about this?
          >
          char const inline static unsigned (*const Func(void))[3]
          >
          Don't you think there's some advantage in having all the keywords in
          alphabetical order? 8-)}
          Excellent comment! You beat me to this one... GMTA (ASDO)

          Comment

          • ena8t8si@yahoo.com

            Re: code portability


            Ian Collins wrote:
            >
            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.
            Kindly take your TDD proselytizing to a newsgroup where
            it's topical.

            Comment

            • jmcgill

              Re: code portability

              ena8t8si@yahoo. com wrote:
              Ian Collins wrote:
              >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.
              >
              Kindly take your TDD proselytizing to a newsgroup where
              it's topical.
              >

              That's a bit harsh.

              Comment

              • Ian Collins

                Re: code portability

                ena8t8si@yahoo. com wrote:
                Ian Collins wrote:
                >
                >>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.
                >
                >
                Kindly take your TDD proselytizing to a newsgroup where
                it's topical.
                >
                Typical knee-jerk reaction of an anonymous closed mind.

                --
                Ian Collins.

                Comment

                • Richard Heathfield

                  Re: code portability

                  Ian Collins said:
                  ena8t8si@yahoo. com wrote:
                  >Ian Collins wrote:
                  >>
                  >>>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.
                  >>
                  >>
                  >Kindly take your TDD proselytizing to a newsgroup where
                  >it's topical.
                  >>
                  Typical knee-jerk reaction of an anonymous closed mind.
                  Then tally up another knee-jerk.

                  Phlip in c.p has made himself a right PITN by going on and on and on about
                  TDD. Please don't make the same mistake. The clc group is about the C
                  language, not about development strategies.

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

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

                  Comment

                  • ena8t8si@yahoo.com

                    Re: code portability


                    jmcgill wrote:
                    ena8t8si@yahoo. com wrote:
                    Ian Collins wrote:
                    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.
                    Kindly take your TDD proselytizing to a newsgroup where
                    it's topical.
                    >
                    >
                    That's a bit harsh.
                    What's harsh about it? It's not topical in comp.lang.c.
                    The word proselytize has a bad rep with some people,
                    but I meant it in the literal sense of the word:

                    To induce someone to join one's own belief or doctrine

                    That seems like a fair and accurate description of the
                    comments I was responding to.

                    Comment

                    • ena8t8si@yahoo.com

                      Re: code portability


                      Ian Collins wrote:
                      ena8t8si@yahoo. com wrote:
                      Ian Collins wrote:
                      >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.

                      Kindly take your TDD proselytizing to a newsgroup where
                      it's topical.
                      Typical knee-jerk reaction of an anonymous closed mind.
                      Regardless of who is having a knee-jerk reaction or who has
                      a closed mind, the topic is still off-topic in comp.lang.c.

                      Comment

                      • jmcgill

                        Re: code portability

                        ena8t8si@yahoo. com wrote:
                        What's harsh about it? It's not topical in comp.lang.c.
                        I do a great deal of unit testing, functional testing, and acceptance
                        testing, and I'd like to know right now if I'm going to be abused by you
                        if the topic comes up with regard to programming and testing C.


                        In particular, I would like to know if you have some sort of moderator
                        authority, or if you are a major contributor to the forum, or any other
                        reason why I should refrain from putting you in my killfile at this time.

                        Comment

                        • Ian Collins

                          Re: code portability

                          Richard Heathfield wrote:
                          Ian Collins said:
                          >
                          >
                          >>ena8t8si@yaho o.com wrote:
                          >>
                          >>>Ian Collins wrote:
                          >>>
                          >>>
                          >>>>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.
                          >>>
                          >>>
                          >>>Kindly take your TDD proselytizing to a newsgroup where
                          >>>it's topical.
                          >>>
                          >>
                          >>Typical knee-jerk reaction of an anonymous closed mind.
                          >
                          >
                          Then tally up another knee-jerk.
                          >
                          Phlip in c.p has made himself a right PITN by going on and on and on about
                          TDD. Please don't make the same mistake. The clc group is about the C
                          language, not about development strategies.
                          >
                          I certainly wouldn't want to be tarred with that brush!

                          --
                          Ian Collins.

                          Comment

                          • Flash Gordon

                            Re: code portability

                            Frederick Gotham wrote:

                            <snip>
                            Posting here, and over on comp.lang.c++, I am disconcerted by the ever-
                            frequent mention of business.
                            Many of us here earn our living writing software.
                            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.
                            What makes you think you have to pervert or dumb down your programming
                            just because you are working for a company? In over 20 years I've never
                            had to do that. I've never had to make code less efficient due to review
                            although when writing assembler I did once have to add in a *lot* more
                            commenting because the code was too convoluted to be followed without
                            massive commenting (it was required to be *extremely* efficient to meet
                            a real time requirement).
                            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.
                            You seem to have developed a very strange idea of what it is to program
                            for a living. Matters of company style of layout are minor and many of
                            us have switched between style to conform. The important thing, and the
                            thing of interest IMHO, is solving the problems and the satisfaction of
                            seeing a customer successfully using your software.
                            In the future, I think I would take great satisfaction from teaching
                            programming, and concurrently working voluntarily on a Standard's
                            Committee.
                            Fine, but you still need to know about programming in the real world, be
                            it the open source community or commercially. The reality is that when
                            more than one person works on a project it is far easier to read if
                            everyone uses the same coding style and in the real world the majority
                            of complex pieces of software are worked on by multiple people.
                            --
                            Flash Gordon
                            Still sigless on this computer.

                            Comment

                            • Richard Heathfield

                              Re: code portability

                              Flash Gordon said:
                              Frederick Gotham wrote:
                              >
                              <snip>
                              >
                              >Posting here, and over on comp.lang.c++, I am disconcerted by the ever-
                              >frequent mention of business.
                              >
                              Many of us here earn our living writing software.
                              Many of us here use third-party libraries written in C. That does not mean
                              that third-party libraries are topical in clc.
                              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.
                              >
                              What makes you think you have to pervert or dumb down your programming
                              just because you are working for a company? In over 20 years I've never
                              had to do that.
                              I have. In one case, I was told to use a separate loop counter for each of
                              several (distinct) loops within a function:

                              int i, j, k;

                              for(i = 0; i < n; i++)
                              {
                              foo(p, i);
                              }

                              DoSomethingThat AffectsSomeElem entsIn(p);

                              for(j = 0; j < n; j++)
                              {
                              bar(p, j);
                              }

                              DoSomethingThat AffectsOtherEle mentsIn(p);

                              for(k = 0; k < n; k++)
                              {
                              bar(p, k);
                              }

                              because the team leader wasn't sure whether the loop counter went out of
                              scope after the termination of the loop in which it was used! This, despite
                              the fact that the loop counters clearly had exactly the same purpose, and
                              affected indexing into exactly the same array.

                              That was a good many years ago, when I was less confident about being able
                              to put my case authoritatively . (I knew I was right, but couldn't prove it
                              to the team leader's satisfaction.)
                              >In the future, I think I would take great satisfaction from teaching
                              >programming, and concurrently working voluntarily on a Standard's
                              >Committee.
                              >
                              Fine, but you still need to know about programming in the real world, be
                              it the open source community or commercially.
                              How is that relevant to comp.lang.c? I understand and indeed share your
                              objections to Mr Gotham's style, but surely that's his problem? He's made
                              his bed, and appears to be happy to lie in it. As long as he doesn't need
                              other people to help him out when he gets stuck, why should he change it?
                              The reality is that when
                              more than one person works on a project it is far easier to read if
                              everyone uses the same coding style and in the real world the majority
                              of complex pieces of software are worked on by multiple people.
                              But not all. There's nothing in the rules that says one person can't write
                              programs on his own. The C Standard allows the syntactic flexibility that
                              Mr Gotham is exploiting, and that's what matters. If we don't wish to read
                              it, we don't have to.

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

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

                              Comment

                              • ena8t8si@yahoo.com

                                Re: code portability


                                jmcgill wrote:
                                ena8t8si@yahoo. com wrote:
                                >
                                What's harsh about it? It's not topical in comp.lang.c.
                                >
                                I do a great deal of unit testing, functional testing, and acceptance
                                testing, ...
                                So do I ...
                                and I'd like to know right now if I'm going to be abused by you
                                if the topic comes up with regard to programming and testing C.
                                If the comments are specific to C, I expect I'll read them with
                                interest. If I think I have something to contribute, there's
                                a good chance I'll reply.

                                If the comments aren't specific to C, but labeled "OT" in the
                                subject line, I might read them or I might not, depending on
                                how much time I have etc.

                                If the comments aren't specific to C, and not labeled OT,
                                most likely I'll do nothing if they occur only occasionally.

                                For repeated, non-C-specific, non-OT-labelled postings,
                                I might respond pointing out the non-topicality and a
                                request to take the topic to another newsgroup.
                                In particular, I would like to know if you have some sort of moderator
                                authority, or if you are a major contributor to the forum, or any other
                                reason why I should refrain from putting you in my killfile at this time.
                                I'm a contributor. I have no official capacity, I speak
                                only for me.

                                Having said that, the reigning culture in comp.lang.c
                                is to remind contributors about what's considered
                                topical, and especially what isn't. You might want
                                to read for a while before deciding which people are
                                worth a killfile entry. But that's up to you.

                                Comment

                                Working...