c programming style

Vicious Oyster oyster at uwmacc.UUCP
Sat Jul 20 05:58:22 AEST 1985


In article <13 at brl-tgr.ARPA> lcc.niket at UCLA-LOCUS.ARPA (Niket K. Patwardhan) writes:
>I am not sure whether you implied C does not interpret
>
>argv = argv + n
>
>as
>
>argv = argv + n*sizeof(argv *)   (treating everything like an int).
>According to the reference manual, adding an int to a pointer (however you do
>it) adds enough to the pointer that the new value points to the object n
>elements away from the original object pointed to. Thus C does the same thing
>as DASL.

   Yeah, you're right.  I still think it sucks swamp water.  People who enjoy
touting the language they use (e.g. C) over, say, Fortran, generally come up
with negative examples like the infamous "Fortran redefining the value of
constants" feature.  I submit that equating a globally recognized set of
constants (i.e. the set of integers) with values that differ depending on
whatever program variable happens to be nearest to them is guaranteed to be
misleading.  Especially when, as I stated in my original posting, it is not  
documented (for DASL, not C).  To my trained and experienced mind, incrementing
and adding a constant are very different things (and C programmers and
language developers are not gods :-).

(Disclaimer for those who believe that a person's greatness depends upon
his or her knowledge of C minutae:  I coded in C only during my few years
in college; I worked with a C-like language in the real world, and now,
among other things, support a Pascal compiler (blecch!)).
-- 
 - joel "vo" plutchak
{allegra,ihnp4,seismo}!uwvax!uwmacc!oyster

"Take what I say in a different way and it's easy to say that this is
all confusion."



More information about the Comp.lang.c mailing list