Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hpda!hpcupt1!jwolf From: jwolf@hpcupt1.HP.COM (John Wolf) Newsgroups: comp.lang.pascal Subject: Re: C Ternary Conditional Expression? Message-ID: <7020004@hpcupt1.HP.COM> Date: 26 May 89 17:24:03 GMT References: <950025@hpclcdb.HP.COM> Organization: Hewlett Packard, Cupertino Lines: 62 I'm not going to get into a discussion of how C or Pascal are better then each other. But there are attributes of C which lend to generation of "more efficient code" (whatever that means). To state three: pointer arithmetic, less stingent type checking and bitwise manipulation. These attributes alone make operating system or low level software development significantly simpler. I currently develop low level (O.S.) software for the hp3000 using a Pascal spinoff. That is, the Pascal used is an enhanced Pascal to accomodate the above stated C attributes among other language shortcomings. This software engineer and others using Pascal here are constantly jumping through hoops and doing contortions to accomplish what C can do in a single statement. Here are some other points: >So why write in the terse C format? I personally think that > > loop = loop + 1; On most machines the above statement would generate an Add machine instrucion... >is more clear than > > loop += 1; > >or the horrendous > > loop++; when on the same machine a increment machine instruction is generated for the two above statements which require less CPU cycles then an add instruction. >And I despise things like > > y = ++x; > >where one has to remember small details (like increment before or after?). Yes, these can be a tough call. However, the above C statement doesn't require the programmer to know 'x's structure size inorder to increment it, thanks to C's smart pointer arithmetic. >(But maybe that, in >part, is why people like to use C. It is a specialized, hidden language like >the Lawyers use to hide or obscure details from "common" people.) > This is true, some programmers enjoy writing terse uncomprehensible code and, there by, cramming two pages of source code into a single page using critic C, it's fun. >All the person writing C has done, then, is to write less clear code in >fewer lines, often making it harder to understand and maintain later (even >by the original author, and even if well commented). > If C had interrupt capabilities there would be no need for coding in assembly. C provides the flexibility of both creating a high level level of abstraction and hugging the paradigm of a given machine - depending on the skills and preference of the programmer. For that reason Programmers eventually leave Pascal behind with the educators for C because C's inherent freedom of expression. Just an opinion, please don't flame John Wolf / X74682 47UP E6 / jwolf@hpda.HP.COM