Path: utzoo!attcan!uunet!husc6!bloom-beacon!apple!bionet!agate!helios.ee.lbl.gov!lll-tis!oodis01!uplherc!sp7040!obie!wsccs!dharvey From: dharvey@wsccs.UUCP (David Harvey) Newsgroups: comp.lang.c Subject: Re: Efficient coding considered harmful? Summary: Efficient vs. readable code Message-ID: <771@wsccs.UUCP> Date: 9 Nov 88 08:56:26 GMT References: <3105@hubcap.UUCP> <34112@XAIT.XEROX.COM> <1700@dataio.Data-IO.COM> <7700@bloom-beacon.MIT.EDU> Lines: 51 The recent postings on the net on this topic has prompted me to respond about a teacher at our college (not necessarily reflecting the opinion of all faculty members) who would fail me for the following code: if( ! something) { ++j; . . . } but would pass me with flying colors for the following: if ( something != 0) { j = j + 1; . . . } As a matter of fact, he would under no circumstances allow me to use the '++', '--', '+=', '-=', '/=', '*=', or '%=' operators. I would LITERALLY be failed if it were there. And yes, he feels that Pascal is much better than C, and Modula2 better yet. In other words, C does have philosophy of coding that emanates a flavor of efficiency. Use it or lose it. By the way, another teacher here loves ANSI C, and every 'enhancement' he mentions smacks me of being Pascalish in orientation. For example, the declaration of variables within the function parentheses will provide the 'protection' that Pascal lovers want only if the compiler can compile both the caller and callee at the same time. Or the linker must be more sophisticated, using information that is generated by the compiler. How will it be handled folks? Either way we lose. If the compiler does it, there goes our modular strategy of putting related functions in seperate files from the functions that use them. But then we could always #include C code files, which is exactly what one of the afore- mentioned teachers required of beginning C students! But what if I want to package a set of functions for users of equipment I manufacture to connect to the computer and I don't want them to have the source? Then the linker will have to do it. Will that cost more for the compiler and linker? You bet your boots it will! My point of view? If you want to program in Pascal, Modula2, Ada, et al, by all means do so. But don't cram your views that make a machine run slower down my throat! If I want to do that I will use Lisp or Prolog where I get something back for what I lost! dharvey@wsccs