From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,baaf5f793d03d420 X-Google-Attributes: gid109fba,public X-Google-Thread: fc89c,97188312486d4578 X-Google-Attributes: gidfc89c,public X-Google-Thread: 1014db,6154de2e240de72a X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,97188312486d4578 X-Google-Attributes: gid103376,public From: seebs@solutions.solon.com (Peter Seebach) Subject: Re: What's the best language to start with? [was: Re: Should I learn C or Pascal?] Date: 1996/08/04 Message-ID: <4u3tt1$qub@solutions.solon.com>#1/1 X-Deja-AN: 172103447 references: <320433CE.6D5A@online.no> <4u1g29$hc0@solutions.solon.com> <01bb826a$b222f400$9bee6fce@timhome2> organization: Usenet Fact Police (Undercover) reply-to: seebs@solon.com newsgroups: comp.lang.c,comp.lang.c++,comp.unix.programmer,comp.lang.ada Date: 1996-08-04T00:00:00+00:00 List-Id: In article <01bb826a$b222f400$9bee6fce@timhome2>, Tim Behrendsen wrote: >Peter Seebach wrote in article ><4u1g29$hc0@solutions.solon.com>... >> A lot of programmers used to habitually use a null pointer as a shortcut >> for "" for string functions; you'd see >> if (strcmp(s, 0)) >> used like >> if (strcmp(s, "")) >> because it worked on some machines. >This completely makes the point. Someone who knows assembly language >would *never* make that mistake, because it would be so obviously >wrong. An interesting theory. Unfortunately, I long since lost track of these articles, but in the old "use the OS vs. bang the metal" flame wars in comp.sys.amiga.programmer, the assembly people would always talk about how the first instruction in their programs was always movel #0,0L (Or however it is that you spell "write 4 bytes of 0 to address 0")... A high-level programmer would never do that, because someone who has learned only the abstract semantics would not think of a null pointer as the address of any real memory. It isn't; it's *guaranteed* that no object has a null pointer as its address. >You cannot program in assembly and not understand a null >pointer v.s. a pointer to a zeroed memory location. And you cannot program in abstract C and think of a null pointer as a pointer to *any* memory location. On many machines that I use, you can't read or write to it; it certainly doesn't *act* like it's memory. The people who did things like that were always assembler programmers relying on their knowledge of what was "really" happening inside the machine. The C abstract semantics clearly forbid it; however, on the majority of common architectures, the hardware doesn't forbid it, and the assumption holds. (By chance, mostly.) -s -- Peter Seebach - seebs@solon.com - Copyright 1996 - http://www.solon.com/~seebs Unix/C Wizard - send mail for help, or send money for consulting! The *other* C FAQ, the hacker FAQ, et al. See web page above. Unsolicited email (junk mail and ads) is unwelcome, and will be billed for.