Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.misc > #962
| From | "Rod Pemberton" <do_not_have@noavailemail.cmm> |
|---|---|
| Newsgroups | comp.lang.misc, comp.lang.c++ |
| Subject | Re: Learning to code by reading code |
| Date | 2012-02-20 04:14 -0500 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <jht2uv$qnq$1@speranza.aioe.org> (permalink) |
| References | (5 earlier) <reading-20120218195201@ram.dialup.fu-berlin.de> <jhpe5i$iug$1@speranza.aioe.org> <assembly-20120219023621@ram.dialup.fu-berlin.de> <jhqde4$grl$1@speranza.aioe.org> <d3b454ac-ae8e-4bd6-b67e-2e8e4050f849@w4g2000vbc.googlegroups.com> |
Cross-posted to 2 groups.
"Nick Keighley" <nick_keighley_nospam@hotmail.com> wrote in message news:d3b454ac-ae8e-4bd6-b67e-2e8e4050f849@w4g2000vbc.googlegroups.com... > On Feb 19, 8:54 am, "Rod Pemberton" <do_not_h...@noavailemail.cmm> > wrote: ... > But I use an imaginary machine [...] > How do you confirm correctness of both high-level and low-level code with an imaginary machine? Is your confirmation of correctness imaginary also? ... That's one of the problems with the ANSI and ISO C specifications: it doesn't specify a working machine model. Without it, there is no reference working version of C that other implementations can be compared against. Without it, everything in the specifications is open to interpretation as to accuracy. That's the major problem that plagues the pedants on comp.lang.c. Each of them has their own model in their head of how C works and what the English words and phrases in the C standards mean. The British frequently have a different understanding of "either-or" versus Americans. It seems that not one of the pedants has ever programmed in assembly or believe they need to. None have read "The C Rationale", or read historical works by the C creators like "The Development of the C Language" or "Portability of C Programs and the UNIX System" or "The C Language Calling Sequence" etc which explain what C is supposed to do and make reference to assembly. If they did, none of them would ever argue against the understanding that C is built upon assembly and assembly is needed to fully understand C. Forth programmers hate the fact that their early specifications did specify a machine model. The problem wasn't that they specified a model, but they specified a very narrow model that wasn't able to adapt, or had radical changes in the following specification. But, that is far better than not specifying one at all. Many Forths were able to comply very accurately with their machine models. That allowed Forth to be widely implemented. Today, a couple of the early specifications are loved, and still used while a couple are hated. > (or these days, C!). > I'm not familiar with the C! language. Did you mean the C language? Perhaps you meant C# language? It seems that Wikipedia, Esolangs, nor Google or Yahoo, will find anything on C! or C exclamation language ... HOPL is inaccessible for some reason. However, if C! is a C derivative, it most likely inherited the basic functionality that a programmer needs to know. Most C derivative languages have kept that functionality because it has become standard due to microprocessors. > [...] but I can't see the utility in converting chunks of > C++ (or scheme or Haskell)into Z80 assembler. Yes, converting C++ for ARM to Z80 to understand how a HLL is converted to assembly would be questionable ... You'd want to study the ARM assembly code generated for C++. They need to understand how a HLL is converted to the assembly for their platform. They need to know how basic language constructs are converted to assembly, e.g., pointers, control-flow, procedures or function calls, etc. > > Many assembly languages > > are very similar. Microprocessors standardized on > > certain concepts around 1974 or so, e.g., 8-bit bytes > > for ASCII and EBCDIC, contiguous memory, pointer > > size equivalent to integer size, typeless integers, etc. > > but many C programmers (and maybe C++ programmers) > assume these are inviolate laws! They end up writing horribly > unportable programs for no reason except intellectual laziness > and lack of imagination about hardware engineers > (and compiler writers) might do. > > Your concentration on assembly code encourages this (naff) > type of coding. Ok, this is the same BS portable C argument that plagues comp.lang.c thought ... The first inherent problem with that argument is that microprocessors have standardized on a basic computing architecture. Nearly all computing platforms today use that architecture either because they are microprocessor based or because they use the same hardware, e.g., memory. They standardized way back around 1974. Mainframes followed suit slightly later. What that means is that almost no one today - or in the past two decades for that matter - has access to obscure, obsoleted, perverse platforms - or other platforms that *NEVER* shouldv'e have been used to create the ANSI C standard in the first place - where "portability" of C or C++ is actually needed. Have you ever had access to a non-emulated EBCDIC platform in your entire lifetime? (No.) Have you ever had access to a 16-bit byte platform in your entire lifetime? (No.) Have you ever had access to a 9-bit character platform in your entire lifetime? (No.) So, like it or not, it's entirely up to the users of obscure platforms to fix the "non-portable" nature of C code for their platforms. The second inherent problem with that argument is even C that is specification compliant is truly only 30% portable. And, that again is due to standardization of microprocessors on 8-bit bytes for ASCII or EBCDIC, contiguous memory, two's complement integers, generic integers so pointers are the same size, etc. Another 50% of C can be made to work correctly, but it's not portable by default. The compiler has to make it work. And, 20% of C is just non-portable. IIRC, you were on c.l.c, so I shouldn't have to mention stuff like setjmp, signals, buffering, POSIX based file I/O, etc. > > Many HLL compilers, e.g., for C, produce the nearly the same > > code but adjusted for different platforms. But, it's still the > > programmer's responsibility to understand what that HLL > > code is producing for their specific tools. > > nope. I get on just fine not knowing what code my HLL is producing. Then, I'd quess you won't get fired for producing faulty code either ... So, that qualifies you as either a novice or hobbyist. (Yes, I suspect you probably aren't ...) A professional would do so as a matter of course. How do you know your compiler is compliant with a specification, or your compiler accurately implements what you expect your code to do? Testing only? What if you missed something you could've caught had you simply just read the assembly? Rod Pemberton
Back to comp.lang.misc | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Learning to code by reading code (was: The way to read STL source code) "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-18 19:00 -0500
Re: Learning to code by reading code "MikeWhy" <boat042-nospam@yahoo.com> - 2012-02-18 22:34 -0600
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-19 03:54 -0500
Re: Learning to code by reading code "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-02-19 10:42 +0100
Re: Learning to code by reading code "BartC" <bc@freeuk.com> - 2012-02-19 22:34 +0000
Re: Learning to code by reading code "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-02-20 12:22 +0100
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-20 03:39 -0500
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-19 03:54 -0500
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-19 08:40 -0800
Re: Learning to code by reading code "MikeWhy" <boat042-nospam@yahoo.com> - 2012-02-19 13:17 -0600
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-20 02:32 -0800
Re: Learning to code by reading code "io_x" <a@b.c.invalid> - 2012-02-20 13:02 +0100
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-20 05:09 -0800
Re: Learning to code by reading code "io_x" <a@b.c.invalid> - 2012-02-20 15:11 +0100
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-20 07:39 -0800
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-20 04:14 -0500
Re: Learning to code by reading code "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-02-20 11:14 +0100
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-20 05:13 -0800
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-20 02:49 -0800
Re: Learning to code by reading code "io_x" <a@b.c.invalid> - 2012-02-20 13:02 +0100
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-20 05:18 -0800
Re: Learning to code by reading code "BartC" <bc@freeuk.com> - 2012-02-20 13:53 +0000
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-21 01:32 -0800
Re: Learning to code by reading code "io_x" <a@b.c.invalid> - 2012-02-21 16:16 +0100
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-21 08:40 -0800
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-20 17:36 -0500
Re: Learning to code by reading code Dombo <dombo@disposable.invalid> - 2012-02-21 00:45 +0100
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-21 04:35 -0500
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-21 08:48 -0800
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-22 00:12 -0800
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-22 06:12 -0500
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-22 04:30 -0800
Re: Learning to code by reading code Geoff <geoff@invalid.invalid> - 2012-02-22 10:45 -0800
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-23 01:12 -0800
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-23 07:34 -0500
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-23 05:46 -0800
Re: Learning to code by reading code "io_x" <a@b.c.invalid> - 2012-02-24 08:38 +0100
Re: Learning to code by reading code "io_x" <a@b.c.invalid> - 2012-02-24 08:40 +0100
Re: Learning to code by reading code "io_x" <a@b.c.invalid> - 2012-02-24 09:38 +0100
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-25 05:25 -0500
Re: Learning to code by reading code Dombo <dombo@disposable.invalid> - 2012-02-25 12:50 +0100
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-25 06:13 -0800
Re: Learning to code by reading code Gareth Owen <gwowen@gmail.com> - 2012-02-26 07:20 +0000
Re: Learning to code by reading code Juha Nieminen <nospam@thanks.invalid> - 2012-02-21 08:23 +0000
Re: Learning to code by reading code Juha Nieminen <nospam@thanks.invalid> - 2012-02-21 08:43 +0000
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-21 04:47 -0500
Re: Learning to code by reading code Juha Nieminen <nospam@thanks.invalid> - 2012-02-21 10:09 +0000
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-22 05:38 -0500
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-21 04:31 -0500
Re: Learning to code by reading code Juha Nieminen <nospam@thanks.invalid> - 2012-02-21 10:05 +0000
Re: Learning to code by reading code "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-02-21 12:21 +0100
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-22 06:04 -0500
Re: Learning to code by reading code "BartC" <bc@freeuk.com> - 2012-02-21 11:01 +0000
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-22 05:59 -0500
Re: Learning to code by reading code "BartC" <bc@freeuk.com> - 2012-02-22 12:59 +0000
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-23 07:03 -0500
Re: Learning to code by reading code "BartC" <bc@freeuk.com> - 2012-02-24 14:20 +0000
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-21 01:27 -0800
Re: Learning to code by reading code Peter Remmers <p.remmers@expires-2011-04-30.arcornews.de> - 2012-02-20 22:25 +0100
Re: Learning to code by reading code Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-26 08:47 +0000
Re: Learning to code by reading code "BartC" <bc@freeuk.com> - 2012-02-26 10:55 +0000
Re: Learning to code by reading code Nomen Nescio <nobody@dizum.com> - 2012-02-22 08:59 +0100
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-22 05:59 -0500
Re: Learning to code by reading code Nomen Nescio <nobody@dizum.com> - 2012-02-22 13:47 +0100
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-23 06:21 -0500
Re: Learning to code by reading code Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-22 00:08 -0800
Re: Learning to code by reading code "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-02-19 03:54 -0500
Re: Learning to code by reading code Marco van de Voort <marcov@toad.stack.nl> - 2012-02-19 11:27 +0000
csiph-web