Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!sci.ccny.cuny.edu!phri!cmcl2!stealth.acf.nyu.edu!brnstnd From: brnstnd@stealth.acf.nyu.edu Newsgroups: comp.lang.c Subject: Re: C official DOD langauge? Message-ID: <17598:Jun611:32:2890@stealth.acf.nyu.edu> Date: 6 Jun 90 11:32:28 GMT References: <1990May30.212533.8105@msuinfo.cl.msu.edu> <1628@dinl.mmc.UUCP> <1630@dinl.mmc.UUCP> <1631@dinl.mmc.UUCP> Reply-To: brnstnd@stealth.acf.nyu.edu (Dan Bernstein) Distribution: usa Organization: IR Lines: 36 In article <1631@dinl.mmc.UUCP> noren@dinl.UUCP (Charles Noren) writes: > C Advantage list: > 3. Data Pointers. Reduces need to copy data which helps > make code faster, allows for reentrant/recursive code, > and the declaration of structures that can be "overlaid" > on memory (useful, for instance, in memory-mapped I/O). It's the stack, not the existence of pointers, that allows recursive calls. > C Disadvantage list: > 4. The Fortran language is designed so that compilers > can make useful assumptions for code optimization, > which cannot be made for C compilers. Two examples: > a. Aliasing is not permitted in Fortran. As has been well hashed out in comp.lang.misc, a slightly intelligent compiler can get around this ``disadvantage'' of C, even within the compile-link model. I don't know of any compilers that do so. > b. The C for statement does not have a well defined > "control variable" and thus cannot be automatically > vectorized. The Convex compiler automatically vectorizes loops; I don't know about the Cray UNICOS compiler. > 5. Array subscripts in C must start with zero, which for > some is counter intuitive But with pointers, or even with simple macros, you can trivially get around this ``restriction.'' After #define b (&a[0] + 3), b can be used as an array of the same size as a, starting from -3. (Hmmm: is it guaranteed by ANSI that &a[0] - 1 + 1 equals a?) ---Dan