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


Groups > comp.lang.c > #107766

Re: Reliable C tutorial for beginners

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: Reliable C tutorial for beginners
Date 2017-04-05 20:36 +0200
Organization A noiseless patient Spider
Message-ID <oc3dar$bnl$2@dont-email.me> (permalink)
References <obvssq$s1n$1@dont-email.me> <58e4d000.1013093@news.xs4all.nl> <4ee47854-2a71-462b-9312-e9abb6d1dbc3@googlegroups.com> <ac884c1c-c855-44a3-afd0-6459ccf91b2f@googlegroups.com>

Show all headers | View raw


On 05/04/17 18:45, supercat@casperkitty.com wrote:
> On Wednesday, April 5, 2017 at 7:55:46 AM UTC-5, jm.bo...@gmail.com wrote:
>> That's what I used to say until a few years ago I reread it and noticed that although the second edition was not describing C as it is practiced nowadays but K&R C with minimal syntax update to make it syntactically acceptable to a C++ compiler used to compensate the lack of C compilers accepting the language described by the then-future standard.  It's a book of the 70's updated in the 80's and it feels.  Read it again and ask yourself: do you really recommend it to someone who does not know C?
>
> There is no single "C as it is practiced nowadays".  C is the name given to
> a set of languages which are diverging into two camps that might be called
> "automatically optimizable C" and "low-level C".  There is no reason the two
> camps should have had to diverge so badly, since it should have been possible
> for a single language to define as optional the features necessary to support
> low-level programming (but say that an implementation must *either* support
> the features or report that it doesn't do so).  Obviously that hasn't happened
> as yet, however.
>
> C was designed as a language where the behavior of "foo->bar = 4" was
> *defined* as taking the address in foo, add the offset of "bar", and store
> the value 4 at the resulting address via whatever means the underlying
> platform would use to store a value of bar's type, and it would do so
> without regard for how that storage might have been used for in the past
> or future.  Code which know how an underlying platform behaves could make
> use of that knowledge to do variety of things that could otherwise not be
> done as efficiently, if at all.
>
> Anyone seeking to work with low-level programs needs to understand how
> low-level constructs work on platforms that support them, and also learn
> the importance of ensuring that a construct will be supported not only by
> a hardware platform, but also by whatever compiler one is using.  K&R is
> a decent book for learning about how the low-level constructs work, but I
> don't know of any book that demonstrates all the constructs that used to
> work but aren't reliable on "modern" processors unless optimizations are
> disabled.
>

There is no such book, because the C language you believe in never 
existed.  These constructs that you think "used to work", only happened 
to work because compilers of years gone by were not as sophisticated as 
modern ones - the language was /never/ designed to work the way you 
think it was.  You are not the only person to think that C was designed 
to be a "portable assembler" and "translate directly to obvious assembly 
code" - but that does not make you right.

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


Thread

Reliable C tutorial for beginners MehdiAmini <atorrses@gmail.com> - 2017-04-04 15:08 +0430
  Re: Reliable C tutorial for beginners Richard Heathfield <rjh@cpax.org.uk> - 2017-04-04 14:10 +0100
    Re: Reliable C tutorial for beginners fir <profesor.fir@gmail.com> - 2017-04-04 09:12 -0700
    Re: Reliable C tutorial for beginners MehdiAmini <atorrses@gmail.com> - 2017-04-05 16:49 +0430
      Re: Reliable C tutorial for beginners Alla <vitale.alla@gmail.com> - 2017-04-05 16:41 +0300
  Re: Reliable C tutorial for beginners raltbos@xs4all.nl (Richard Bos) - 2017-04-05 11:10 +0000
    Re: Reliable C tutorial for beginners jm.bourguet@gmail.com - 2017-04-05 05:55 -0700
      Re: Reliable C tutorial for beginners fir <profesor.fir@gmail.com> - 2017-04-05 08:01 -0700
      Re: Reliable C tutorial for beginners supercat@casperkitty.com - 2017-04-05 09:45 -0700
        Re: Reliable C tutorial for beginners Jean-Marc Bourguet <jm@bourguet.org> - 2017-04-05 20:04 +0200
        Re: Reliable C tutorial for beginners David Brown <david.brown@hesbynett.no> - 2017-04-05 20:36 +0200
          Re: Reliable C tutorial for beginners supercat@casperkitty.com - 2017-04-05 14:26 -0700
            Re: Reliable C tutorial for beginners David Brown <david.brown@hesbynett.no> - 2017-04-06 09:41 +0200
              Re: Reliable C tutorial for beginners supercat@casperkitty.com - 2017-04-06 07:53 -0700
                Re: Reliable C tutorial for beginners scott@slp53.sl.home (Scott Lurndal) - 2017-04-06 15:12 +0000
                Re: Reliable C tutorial for beginners Keith Thompson <kst-u@mib.org> - 2017-04-06 09:12 -0700
                Re: Reliable C tutorial for beginners scott@slp53.sl.home (Scott Lurndal) - 2017-04-06 16:20 +0000
                Re: Reliable C tutorial for beginners Keith Thompson <kst-u@mib.org> - 2017-04-06 09:26 -0700
                Re: Reliable C tutorial for beginners Keith Thompson <kst-u@mib.org> - 2017-04-06 11:53 -0700
                Re: Reliable C tutorial for beginners Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2017-04-06 12:26 -0400
                Re: Reliable C tutorial for beginners scott@slp53.sl.home (Scott Lurndal) - 2017-04-06 17:09 +0000
                Re: Reliable C tutorial for beginners supercat@casperkitty.com - 2017-04-06 10:37 -0700
                Re: Reliable C tutorial for beginners scott@slp53.sl.home (Scott Lurndal) - 2017-04-06 18:50 +0000
                Re: Reliable C tutorial for beginners David Brown <david.brown@hesbynett.no> - 2017-04-06 21:46 +0200
                Re: Reliable C tutorial for beginners supercat@casperkitty.com - 2017-04-06 14:51 -0700
                Re: Reliable C tutorial for beginners raltbos@xs4all.nl (Richard Bos) - 2017-04-09 13:42 +0000
                Re: Linux and GCC Noob <root@127.0.0.1> - 2017-04-09 16:45 +0200
                Re: Linux and GCC David Brown <david.brown@hesbynett.no> - 2017-04-09 16:50 +0200
                Re: Linux and GCC Noob <root@127.0.0.1> - 2017-04-09 17:06 +0200
                Re: Linux and GCC raltbos@xs4all.nl (Richard Bos) - 2017-04-14 11:39 +0000
                Re: Linux and GCC Tim Rentsch <txr@alumni.caltech.edu> - 2017-04-16 17:41 -0700
                Re: Linux and GCC David Brown <david.brown@hesbynett.no> - 2017-04-17 17:46 +0200
                Re: Linux and GCC David Brown <david.brown@hesbynett.no> - 2017-04-17 17:37 +0200
                Re: Linux and GCC supercat@casperkitty.com - 2017-04-17 09:19 -0700
      Re: Reliable C tutorial for beginners Keith Thompson <kst-u@mib.org> - 2017-04-05 13:50 -0700
        Re: Reliable C tutorial for beginners supercat@casperkitty.com - 2017-04-05 14:47 -0700
          Re: Reliable C tutorial for beginners David Brown <david.brown@hesbynett.no> - 2017-04-06 09:45 +0200
        Re: Reliable C tutorial for beginners jm.bourguet@gmail.com - 2017-04-06 01:57 -0700
  Re: Reliable C tutorial for beginners Real Troll <real.troll@trolls.com> - 2017-04-05 15:16 -0500
    Re: Reliable C tutorial for beginners GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-04-06 11:56 +0200
  Re: Reliable C tutorial for beginners Spiros Bousbouras <spibou@gmail.com> - 2017-04-06 14:14 +0000
    Re: Reliable C tutorial for beginners "C-bot" <cbot@example.com> - 2017-04-08 01:18 +0000
      Re: Reliable C tutorial for beginners Spiros Bousbouras <spibou@gmail.com> - 2017-04-08 14:54 +0000
      Re: Reliable C tutorial for beginners Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-08 19:01 +0100
        Re: Reliable C tutorial for beginners Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-09 00:04 +0100
        Re: Reliable C tutorial for beginners Jean-Marc Bourguet <jm@bourguet.org> - 2017-04-09 14:03 +0200
          Re: Reliable C tutorial for beginners Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-04-09 15:02 -0600
            Re: Reliable C tutorial for beginners "Chris M. Thomasson" <invalid@invalid.invalid> - 2017-04-09 14:13 -0700
            Re: Reliable C tutorial for beginners Real Troll <real.troll@trolls.com> - 2017-04-09 17:30 -0400
        Re: Reliable C tutorial for beginners Richard Heathfield <rjh@cpax.org.uk> - 2017-04-10 18:35 +0100

csiph-web