Pointer Guide Nearing Completion

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

    #1

    Pointer Guide Nearing Completion



    Tell me what you think...
  • Richard Bos

    #2
    Re: Pointer Guide Nearing Completion

    foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
    [color=blue]
    > http://thelinuxlink.net/~fingolfin/pointer-guide
    >
    > Tell me what you think...[/color]

    I think you should get the distinction between zero and null clear, and
    learn not to invoke undefined behaviour, before you start teaching
    others about pointers.

    Richard

    Comment

    • Foobarius Frobinium

      #3
      Re: Pointer Guide Nearing Completion

      rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message news:<41752130. 90804304@news.i ndividual.net>. ..[color=blue]
      > foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
      >[color=green]
      > > http://thelinuxlink.net/~fingolfin/pointer-guide
      > >
      > > Tell me what you think...[/color]
      >
      > I think you should get the distinction between zero and null clear, and
      > learn not to invoke undefined behaviour, before you start teaching
      > others about pointers.[/color]

      Where do I invoke undefined behavior, besides the part marked /* ERROR!! */??
      [color=blue]
      >
      > Richard[/color]

      Comment

      • Arthur J. O'Dwyer

        #4
        Re: Pointer Guide Nearing Completion


        On Wed, 20 Oct 2004, Foobarius Frobinium wrote:[color=blue]
        >
        > Richard Bos wrote:[color=green]
        >> foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:[color=darkred]
        >>>
        >>> http://thelinuxlink.net/~fingolfin/pointer-guide[/color]
        >>
        >> I think you should get the distinction between zero and null clear, and
        >> learn not to invoke undefined behaviour, before you start teaching
        >> others about pointers.[/color]
        >
        > Where do I invoke undefined behavior, besides the part marked
        > /* ERROR!! */??[/color]

        The second example on the page, which is also the place you confuse
        "zero" and "null." And again in the fourth example. Maybe some
        other places; I just skimmed to find the things Richard must have been
        referring to.

        -Arthur

        Comment

        • Richard Bos

          #5
          Re: Pointer Guide Nearing Completion

          foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
          [color=blue]
          > rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message news:<41752130. 90804304@news.i ndividual.net>. ..[color=green]
          > > foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
          > >[color=darkred]
          > > > http://thelinuxlink.net/~fingolfin/pointer-guide
          > > >
          > > > Tell me what you think...[/color]
          > >
          > > I think you should get the distinction between zero and null clear, and
          > > learn not to invoke undefined behaviour, before you start teaching
          > > others about pointers.[/color]
          >
          > Where do I invoke undefined behavior, besides the part marked /* ERROR!! */??[/color]

          The issue I was mainly referring to has come up so bloody often on this
          newsgroup, that if you'd ever read it for comprehension you'd have know
          _exactly_ what I was talking about. Since I don't think that someone
          incompetent should be teaching others on the use of pointers (because
          it's too bloody dangerous), that's all the help you will get from me.

          Richard

          Comment

          • Foobarius Frobinium

            #6
            Re: Pointer Guide Nearing Completion

            rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message news:<41768277. 181256487@news. individual.net> ...[color=blue]
            > foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
            >[color=green]
            > > rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message news:<41752130. 90804304@news.i ndividual.net>. ..[color=darkred]
            > > > foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
            > > >
            > > > > http://thelinuxlink.net/~fingolfin/pointer-guide
            > > > >
            > > > > Tell me what you think...
            > > >
            > > > I think you should get the distinction between zero and null clear, and
            > > > learn not to invoke undefined behaviour, before you start teaching
            > > > others about pointers.[/color]
            > >
            > > Where do I invoke undefined behavior, besides the part marked /* ERROR!! */??[/color]
            >
            > The issue I was mainly referring to has come up so bloody often on this
            > newsgroup, that if you'd ever read it for comprehension you'd have know
            > _exactly_ what I was talking about. Since I don't think that someone
            > incompetent should be teaching others on the use of pointers (because
            > it's too bloody dangerous),[/color]

            Then you'd better get working, going around to all those universities
            and colleges where the CS professors confuse arrays and
            pointers...thei r infractions are far worse. (And there's plenty of
            them.)

            Dangerous? Is somebody going to lose a leg?
            [color=blue]
            > that's all the help you will get from me.
            >
            > Richard[/color]

            Comment

            • Michael Mair

              #7
              Re: Pointer Guide Nearing Completion


              Foobarius Frobinium wrote:[color=blue]
              > rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message news:<41768277. 181256487@news. individual.net> ...[color=green]
              >>foobarus@your emailbox.com (Foobarius Frobinium) wrote:[color=darkred]
              >>>rlb@hoekst ra-uitgeverij.nl (Richard Bos) wrote in message news:<41752130. 90804304@news.i ndividual.net>. ..
              >>>>foobarus@yo uremailbox.com (Foobarius Frobinium) wrote:
              >>>>
              >>>>>http://thelinuxlink.net/~fingolfin/pointer-guide
              >>>>>
              >>>>>Tell me what you think...
              >>>>
              >>>>I think you should get the distinction between zero and null clear, and
              >>>>learn not to invoke undefined behaviour, before you start teaching
              >>>>others about pointers.
              >>>
              >>>Where do I invoke undefined behavior, besides the part marked /* ERROR!! */??[/color]
              >>
              >>The issue I was mainly referring to has come up so bloody often on this
              >>newsgroup, that if you'd ever read it for comprehension you'd have know
              >>_exactly_ what I was talking about. Since I don't think that someone
              >>incompetent should be teaching others on the use of pointers (because
              >>it's too bloody dangerous),[/color]
              >
              > Then you'd better get working, going around to all those universities
              > and colleges where the CS professors confuse arrays and
              > pointers...thei r infractions are far worse. (And there's plenty of
              > them.)[/color]

              And why exactly do you want to be counted among the ranks of
              the incompetent and dangerously stupid?
              Learn from Richard's comments, mend your ways and the misinformation
              you spread.

              [color=blue]
              > Dangerous? Is somebody going to lose a leg?[/color]

              I see a certain danger in having the least qualified candidates teach
              the next generations.
              Apart from that:
              It may not have occurred to you yet, but some of the people you
              teach one day may work on real life applications. And there,
              UB may creep in at the most inconvenient place and strike when
              lives or inviolacy depend on what some piece of software does or
              did. I certainly would not find it merely inconvenient if I produced
              some wrong simulation results causing a structural weakness in a
              vehicle which is only exhibited in situations which have not been
              tested, for example.
              And, having seen more then one one-week-course-too-teach-you-all
              with all its minor and major errors, this is a possibility.


              -Michael
              --
              E-Mail: Mine is a gmx dot de address.

              Comment

              • Foobarius Frobinium

                #8
                Re: Pointer Guide Nearing Completion

                "Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote in message news:<Pine.LNX. 4.60-041.04102011062 00.3352@unix40. andrew.cmu.edu> ...[color=blue]
                > On Wed, 20 Oct 2004, Foobarius Frobinium wrote:[color=green]
                > >
                > > Richard Bos wrote:[color=darkred]
                > >> foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
                > >>>
                > >>> http://thelinuxlink.net/~fingolfin/pointer-guide
                > >>
                > >> I think you should get the distinction between zero and null clear, and
                > >> learn not to invoke undefined behaviour, before you start teaching
                > >> others about pointers.[/color]
                > >
                > > Where do I invoke undefined behavior, besides the part marked
                > > /* ERROR!! */??[/color]
                >
                > The second example on the page, which is also the place you confuse
                > "zero" and "null." And again in the fourth example. Maybe some
                > other places; I just skimmed to find the things Richard must have been
                > referring to.[/color]

                I did fix the NULL bit; yes that was pretty bad.

                But I can't help but take offense when I come to an NG, not wanting to
                cause trouble, and I get a completely uncalled-for brow-beating from
                someone, who in this case is one Mr. Vos.

                Failing to adhere to a certain feature of the C standard does not
                deserve anything more than a kind correction. I taught myself
                everything I know about C and pointers, taking special pains to pull
                together various bits of frequently incorrect documentation both in
                books and on the web (the C FAQ was especially useful), and I'm just
                trying to help others. I wouldn't say I'm a C expert; I haven't even
                graduated high school yet. I intend to divulge what I've learned in a
                comprehensive format. In the process, I merely ask for a little
                assistance, not for someone else to bend over backwards, and it seems
                I won't get any.

                Hence I implore everyone on this NG to behave a little more
                respectfully, and remember there /is/ a real person on the other side
                of the news server.
                [color=blue]
                >
                > -Arthur[/color]

                Comment

                • Alan Balmer

                  #9
                  Re: Pointer Guide Nearing Completion

                  On 21 Oct 2004 06:59:49 -0700, foobarus@yourem ailbox.com (Foobarius
                  Frobinium) wrote:
                  [color=blue]
                  >"Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote in message news:<Pine.LNX. 4.60-041.04102011062 00.3352@unix40. andrew.cmu.edu> ...[color=green]
                  >> On Wed, 20 Oct 2004, Foobarius Frobinium wrote:[color=darkred]
                  >> >
                  >> > Richard Bos wrote:
                  >> >> foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
                  >> >>>
                  >> >>> http://thelinuxlink.net/~fingolfin/pointer-guide
                  >> >>
                  >> >> I think you should get the distinction between zero and null clear, and
                  >> >> learn not to invoke undefined behaviour, before you start teaching
                  >> >> others about pointers.
                  >> >
                  >> > Where do I invoke undefined behavior, besides the part marked
                  >> > /* ERROR!! */??[/color]
                  >>
                  >> The second example on the page, which is also the place you confuse
                  >> "zero" and "null." And again in the fourth example. Maybe some
                  >> other places; I just skimmed to find the things Richard must have been
                  >> referring to.[/color]
                  >
                  >I did fix the NULL bit; yes that was pretty bad.
                  >
                  >But I can't help but take offense when I come to an NG, not wanting to
                  >cause trouble, and I get a completely uncalled-for brow-beating from
                  >someone, who in this case is one Mr. Vos.[/color]

                  The above remarks by Mr. Bos hardly qualify as browbeating. You
                  present yourself as someone qualified to teach others about pointers,
                  and must expect that folks in this group won't let you get away with
                  inaccuracies.

                  --
                  Al Balmer
                  Balmer Consulting
                  removebalmercon sultingthis@att .net

                  Comment

                  • Alan Balmer

                    #10
                    Re: Pointer Guide Nearing Completion

                    On 21 Oct 2004 04:50:25 -0700, foobarus@yourem ailbox.com (Foobarius
                    Frobinium) wrote:
                    [color=blue]
                    >rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message news:<41768277. 181256487@news. individual.net> ...[color=green]
                    >> foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
                    >>[color=darkred]
                    >> > rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message news:<41752130. 90804304@news.i ndividual.net>. ..
                    >> > > foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
                    >> > >
                    >> > > > http://thelinuxlink.net/~fingolfin/pointer-guide
                    >> > > >
                    >> > > > Tell me what you think...
                    >> > >
                    >> > > I think you should get the distinction between zero and null clear, and
                    >> > > learn not to invoke undefined behaviour, before you start teaching
                    >> > > others about pointers.
                    >> >
                    >> > Where do I invoke undefined behavior, besides the part marked /* ERROR!! */??[/color]
                    >>
                    >> The issue I was mainly referring to has come up so bloody often on this
                    >> newsgroup, that if you'd ever read it for comprehension you'd have know
                    >> _exactly_ what I was talking about. Since I don't think that someone
                    >> incompetent should be teaching others on the use of pointers (because
                    >> it's too bloody dangerous),[/color]
                    >
                    >Then you'd better get working, going around to all those universities
                    >and colleges where the CS professors confuse arrays and
                    >pointers...the ir infractions are far worse. (And there's plenty of
                    >them.)
                    >[/color]
                    How would you know that, not having even graduated high school yet?
                    [color=blue]
                    >Dangerous? Is somebody going to lose a leg?
                    >[/color]
                    It could be far worse than that. I worked for twenty years in an
                    industry where a program's undefined behavior can (and sometimes does)
                    kill people.

                    --
                    Al Balmer
                    Balmer Consulting
                    removebalmercon sultingthis@att .net

                    Comment

                    • Mike Wahler

                      #11
                      Re: Pointer Guide Nearing Completion

                      "Foobarius Frobinium" <foobarus@youre mailbox.com> wrote in message
                      news:a7e7762a.0 410210350.45695 bc3@posting.goo gle.com...[color=blue]
                      > rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message[/color]
                      news:<41768277. 181256487@news. individual.net> ...[color=blue][color=green]
                      > > foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
                      > >[color=darkred]
                      > > > rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message[/color][/color][/color]
                      news:<41752130. 90804304@news.i ndividual.net>. ..[color=blue][color=green]
                      > > The issue I was mainly referring to has come up so bloody often on this
                      > > newsgroup, that if you'd ever read it for comprehension you'd have know
                      > > _exactly_ what I was talking about. Since I don't think that someone
                      > > incompetent should be teaching others on the use of pointers (because
                      > > it's too bloody dangerous),[/color]
                      >
                      > Then you'd better get working, going around to all those universities
                      > and colleges where the CS professors confuse arrays and
                      > pointers...thei r infractions are far worse. (And there's plenty of
                      > them.)[/color]

                      Yes, most of us are well aware of the plethora of incompetent
                      instructors out there. We don't need any more of them, or anyone
                      else helping to spread their misinformation. We do our best to
                      minimize the damage they cause.
                      [color=blue]
                      > Dangerous? Is somebody going to lose a leg?[/color]

                      Yes, there is a very real possibility that could happen as
                      the result of a software failure (I suspect that that, and
                      worse, has already occurred).

                      -Mike


                      Comment

                      • Eric Sosman

                        #12
                        Re: Pointer Guide Nearing Completion

                        Foobarius Frobinium wrote:[color=blue]
                        > rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message news:<41768277. 181256487@news. individual.net> ...
                        > [...][color=green]
                        >>The issue I was mainly referring to has come up so bloody often on this
                        >>newsgroup, that if you'd ever read it for comprehension you'd have know
                        >>_exactly_ what I was talking about. Since I don't think that someone
                        >>incompetent should be teaching others on the use of pointers (because
                        >>it's too bloody dangerous),[/color]
                        >
                        >
                        > Then you'd better get working, going around to all those universities
                        > and colleges where the CS professors confuse arrays and
                        > pointers...thei r infractions are far worse. (And there's plenty of
                        > them.)
                        >
                        > Dangerous? Is somebody going to lose a leg?[/color]

                        If you don't think software faults can be dangerous,
                        Google for "Therac-25." True, the bug wasn't a pointer
                        problem -- but it *killed* people, as in stone-cold dead.
                        It could even be argued that the problem wasn't a "bug;"
                        the code was probably "good enough" for its original
                        purpose and only became dangerous when re-used in a less
                        forgiving context -- but in any event, the victims are
                        not in a position to give us their insights.

                        Do computer curricula nowadays include the tale of
                        the Therac, or other sobering stories? Seems to me it'd
                        be a good idea if they did.

                        --
                        Eric.Sosman@sun .com

                        Comment

                        • Old Wolf

                          #13
                          Re: Pointer Guide Nearing Completion

                          foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:[color=blue]
                          > "Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote:[color=green]
                          > > On Wed, 20 Oct 2004, Foobarius Frobinium wrote:[color=darkred]
                          > > >> foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
                          > > >
                          > > > Where do I invoke undefined behavior, besides the part marked
                          > > > /* ERROR!! */??[/color]
                          > >
                          > > The second example on the page, which is also the place you confuse
                          > > "zero" and "null." And again in the fourth example. Maybe some
                          > > other places; I just skimmed to find the things Richard must have been
                          > > referring to.[/color]
                          >
                          > I did fix the NULL bit; yes that was pretty bad.[/color]

                          It still isn't fixed. You wrote:
                          [color=blue]
                          > NULL is defined by your C compiler as a pointer to nothing;[/color]

                          It is a pointer that doesn't point anywhere. There is no 'nothing'
                          that it points to.
                          [color=blue]
                          >usually it is (void *) 0. (The void pointer is explained below.)
                          >Usually, NULL is a void pointer to address 0, but, it's best to
                          >use the NULL definition, just to be safe and for clarity.[/color]

                          You imply (even if unintentionally ) that NULL might be something
                          other than 0. The only reason to write NULL instead of (void *)0
                          is clarity; safety does not come into it. NULL _must_ be the
                          integer 0 , optionally cast to a pointer type.

                          This confusion is compounded by the fact that you use ints
                          for addresses in your code. The reader may well end up thinking
                          that (void *)0 means address 0, you do not have any text that
                          educates him otherwise. I suggest using segment:offset addresses
                          everywhere in your examples, so that it is clear that ints
                          and pointers are NOT interchangeable .

                          Also, all of your examples with malloc() have undefined
                          behaviour. Read the FAQ on how to invoke malloc properly.
                          There is no such word "casted" and your explanation of
                          the cast is very poor. (Needless to say, you should omit
                          the cast entirely, and probably omit any discussion of
                          the return type of malloc).

                          Comment

                          • Foobarius Frobinium

                            #14
                            Re: Pointer Guide Nearing Completion

                            Alan Balmer <albalmer@att.n et> wrote in message news:<6hlfn0h27 elgfqnt63kahm6q l8ii6342va@4ax. com>...[color=blue]
                            > On 21 Oct 2004 04:50:25 -0700, foobarus@yourem ailbox.com (Foobarius
                            > Frobinium) wrote:
                            >[color=green]
                            > >rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message news:<41768277. 181256487@news. individual.net> ...[color=darkred]
                            > >> foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
                            > >>
                            > >> > rlb@hoekstra-uitgeverij.nl (Richard Bos) wrote in message news:<41752130. 90804304@news.i ndividual.net>. ..
                            > >> > > foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
                            > >> > >
                            > >> > > > http://thelinuxlink.net/~fingolfin/pointer-guide
                            > >> > > >
                            > >> > > > Tell me what you think...
                            > >> > >
                            > >> > > I think you should get the distinction between zero and null clear, and
                            > >> > > learn not to invoke undefined behaviour, before you start teaching
                            > >> > > others about pointers.
                            > >> >
                            > >> > Where do I invoke undefined behavior, besides the part marked /* ERROR!! */??
                            > >>
                            > >> The issue I was mainly referring to has come up so bloody often on this
                            > >> newsgroup, that if you'd ever read it for comprehension you'd have know
                            > >> _exactly_ what I was talking about. Since I don't think that someone
                            > >> incompetent should be teaching others on the use of pointers (because
                            > >> it's too bloody dangerous),[/color]
                            > >
                            > >Then you'd better get working, going around to all those universities
                            > >and colleges where the CS professors confuse arrays and
                            > >pointers...the ir infractions are far worse. (And there's plenty of
                            > >them.)
                            > >[/color]
                            > How would you know that, not having even graduated high school yet?[/color]

                            A lot of my friends are adults, in Computer Science, who told me about
                            this. Plus I've /seen/, here and there, parts of CS courses published
                            on the web where that kind of error occurs. It's a little depressing
                            to be honest with you.

                            Anyways, I agree that NULL != 0, and I made the changes in five
                            minutes with vi.
                            [color=blue]
                            >[color=green]
                            > >Dangerous? Is somebody going to lose a leg?
                            > >[/color]
                            > It could be far worse than that. I worked for twenty years in an
                            > industry where a program's undefined behavior can (and sometimes does)
                            > kill people.[/color]

                            Well, then, for safety's sake, we'd better get moving! For the sake of
                            curiousity, what languages does an embedded device usually use? (I
                            usually hear of a small Scheme dialect, C, or ugh...Java)

                            Comment

                            • Foobarius Frobinium

                              #15
                              Re: Pointer Guide Nearing Completion

                              Alan Balmer <albalmer@att.n et> wrote in message news:<o8lfn0lkc 9dusd150up83nld b0lqiapdgc@4ax. com>...[color=blue]
                              > On 21 Oct 2004 06:59:49 -0700, foobarus@yourem ailbox.com (Foobarius
                              > Frobinium) wrote:
                              >[color=green]
                              > >"Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote in message news:<Pine.LNX. 4.60-041.04102011062 00.3352@unix40. andrew.cmu.edu> ...[color=darkred]
                              > >> On Wed, 20 Oct 2004, Foobarius Frobinium wrote:
                              > >> >
                              > >> > Richard Bos wrote:
                              > >> >> foobarus@yourem ailbox.com (Foobarius Frobinium) wrote:
                              > >> >>>
                              > >> >>> http://thelinuxlink.net/~fingolfin/pointer-guide
                              > >> >>
                              > >> >> I think you should get the distinction between zero and null clear, and
                              > >> >> learn not to invoke undefined behaviour, before you start teaching
                              > >> >> others about pointers.
                              > >> >
                              > >> > Where do I invoke undefined behavior, besides the part marked
                              > >> > /* ERROR!! */??
                              > >>
                              > >> The second example on the page, which is also the place you confuse
                              > >> "zero" and "null." And again in the fourth example. Maybe some
                              > >> other places; I just skimmed to find the things Richard must have been
                              > >> referring to.[/color]
                              > >
                              > >I did fix the NULL bit; yes that was pretty bad.
                              > >
                              > >But I can't help but take offense when I come to an NG, not wanting to
                              > >cause trouble, and I get a completely uncalled-for brow-beating from
                              > >someone, who in this case is one Mr. Vos.[/color]
                              >
                              > The above remarks by Mr. Bos hardly qualify as browbeating.[/color]

                              The saying goes: don't look down on someone unless you are helping
                              them up. (usually attributed to MLK Jr.) If you aren't going to help
                              someone up, don't complain about their alleged incompetence (see
                              elsewhere in the thread).
                              [color=blue]
                              > You
                              > present yourself as someone qualified to teach others about pointers,
                              > and must expect that folks in this group won't let you get away with
                              > inaccuracies.[/color]

                              Yes, and this is why I submitted the guide for review in the first
                              place. The first drafts had some issues, and I weeded them out,
                              resulting in a better document each time. And each time I submitted
                              it, I had less complaints even from the most critical readers. Even if
                              the criticisms are rudely delivered, I always take them into account,
                              and make changes according to them.

                              Comment

                              Working...