Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #153572

Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide
Date 2020-08-12 12:23 -0700
Organization None to speak of
Message-ID <877du33by4.fsf@nosuchdomain.example.com> (permalink)
References <rh1du1$q82$1@dont-email.me>

Show all headers | View raw


[Cross-post to comp.lang.c++ removed]

Lynn McGuire <lynnmcguire5@gmail.com> writes:
> "Why the C Language Will Never Stop You from Making Mistakes" by
> JeanHeyd Meneide
>
> https://thephd.github.io/your-c-compiler-and-standard-library-will-not-help-you
>
> "Short answer: because we said so."
>
> Yup.
>
> "The C Language"
>
> "Or, as I like to call it, “The Type Safety Is For Losers
> Language”. Of course, that’s a mouthful, so “C” will have to do. You
> may be wondering why I would call a language like C as having no type
> safety."
>
> Cool, them are fighting words !
>
> Oh wait, he is correct.

He uses this example:

    struct Meow* p_cat = (struct Meow*)malloc(sizeof(struct Meow));
    struct Bark* p_dog = p_cat;

and says:

    Yes, two entirely unrelated pointer types can be set to one another
    in standards-conforming C. Most compilers warn, but it is
    standards-conforming to accept this code unless you crank up the
    -Werror -Wall -Wpedantic etc. etc. etc.

Of course the initialization of p_dog is a constraint violation.  There
is no implicit conversion between incompatible pointer types (other than
the special case of void*).

There is a valid point here, that many compilers in their default
configurations will allow the initialization with a non-fatal
warning, but "constraint violation" is as close as C gets to saying
something is illegal (aside from #error).  (He does acknowledge
that it's a constraint violation, but he doesn't seem to think
that's terribly significant.)

There is a valid point here, that C's requirements for diagnostic
are rather weak, but most or all compilers do provide options to
enforce the rules strictly, and I think most production code is
written to follow the rules.

C isn't nearly as lax as he implies it is.

Casting the result of malloc is also disturbing.

Apparently the author is now the Project Editor for the ISO C
Committee.  I am concerned.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

"Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Lynn McGuire <lynnmcguire5@gmail.com> - 2020-08-12 13:54 -0500
  Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-08-12 12:23 -0700
    Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Elijah Stone <elronnd@elronnd.net> - 2020-08-12 15:05 -0700
      Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Richard Damon <Richard@Damon-Family.org> - 2020-08-12 19:15 -0400
        Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Philipp Klaus Krause <pkk@spth.de> - 2020-08-13 10:36 +0200
          Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Poprocks <please@replytogroup.com> - 2020-08-13 14:23 +0000
            What do when -Werror gets in your way (Was: "Why the C Language Will Never Stop You from Making Mistakes") by JeanHeyd Meneide gazelle@shell.xmission.com (Kenny McCormack) - 2020-08-13 14:49 +0000
        Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Elijah Stone <elronnd@elronnd.net> - 2020-08-13 23:25 -0700
      Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide John Forkosh <forkosh@panix.com> - 2020-08-13 01:15 +0000
        Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-08-12 18:42 -0700
          Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide John Forkosh <forkosh@panix.com> - 2020-08-13 06:15 +0000
            Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-08-12 23:23 -0700
              Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide John Forkosh <forkosh@panix.com> - 2020-08-13 06:44 +0000
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Poprocks <please@replytogroup.com> - 2020-08-15 22:51 +0000
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Richard Damon <Richard@Damon-Family.org> - 2020-08-15 19:41 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-08-16 02:02 +0100
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide John Forkosh <forkosh@panix.com> - 2020-08-16 05:47 +0000
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-08-16 12:03 +0100
                Kinda by definition... (Was: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide) gazelle@shell.xmission.com (Kenny McCormack) - 2020-08-16 11:49 +0000
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-08-16 05:33 -0700
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide John Forkosh <forkosh@panix.com> - 2020-08-17 06:27 +0000
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Richard Damon <Richard@Damon-Family.org> - 2020-08-16 09:12 -0400
              Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Richard Damon <Richard@Damon-Family.org> - 2020-08-13 07:38 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-08-13 09:33 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Richard Damon <Richard@Damon-Family.org> - 2020-08-14 10:50 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-08-14 12:39 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Richard Damon <Richard@Damon-Family.org> - 2020-08-14 16:53 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-08-14 19:49 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-08-15 02:31 -0700
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-08-15 16:10 -0700
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Richard Damon <Richard@Damon-Family.org> - 2020-08-16 09:25 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-08-16 10:50 -0700
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-08-16 15:40 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Richard Damon <Richard@Damon-Family.org> - 2020-08-16 19:39 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-08-16 21:12 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Richard Harnden <richard.nospam@gmail.com> - 2020-08-18 08:47 +0100
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-08-18 08:26 -0400
              Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide gazelle@shell.xmission.com (Kenny McCormack) - 2020-08-13 12:48 +0000
            Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide John Bode <jfbode1029@gmail.com> - 2020-08-13 09:46 -0700
      Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-08-13 06:14 +0000
    Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Anton Shepelev <anton.txt@gmail.com> - 2020-08-13 01:19 +0300
      Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-08-12 16:18 -0700
    Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Scott Newman <scott69@gmail.com> - 2020-08-13 09:25 +0200
      Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-08-13 00:41 -0700
        Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Scott Newman <scott69@gmail.com> - 2020-08-13 12:53 +0200
          Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Richard Harnden <richard.nospam@gmail.com> - 2020-08-13 12:52 +0100
            Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide David Brown <david.brown@hesbynett.no> - 2020-08-13 15:17 +0200
          Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-08-13 10:38 -0700
            Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Scott Newman <scott69@gmail.com> - 2020-08-13 19:44 +0200
              Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Bart <bc@freeuk.com> - 2020-08-13 19:10 +0100
              Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-08-13 11:42 -0700
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide scott@slp53.sl.home (Scott Lurndal) - 2020-08-14 05:56 +0000
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Bonita Montero <Bonita.Montero@gmail.com> - 2020-08-14 09:14 +0200
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-08-14 08:45 -0400
                Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide gazelle@shell.xmission.com (Kenny McCormack) - 2020-08-14 16:51 +0000
            Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Ian Collins <ian-news@hotmail.com> - 2020-08-15 09:11 +1200
    Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-08-24 16:58 -0700
  Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Philipp Klaus Krause <pkk@spth.de> - 2020-08-13 10:32 +0200
    Re: "Why the C Language Will Never Stop You from Making Mistakes" by JeanHeyd Meneide Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-08-23 07:04 -0700

csiph-web