Use of i++; Re: C programming style

Steven List itkin at luke.UUCP
Sun Jul 21 05:30:43 AEST 1985


Having read through much of the recent discussion, I'm amused by one
omission: ++i (and it's relatives)!  The original poster (at least I
think it was the original) suggests a function (or macro)
"increment(i)".  The function/macro approach does not deal with the
sequence of events.  The nominal case of incrementing a variable in a
simple expression

	i++;

is trivial.  How about in a loop:

	char buf[80];
	char *cp = buf;

	/* always leave the first character alone */

	while (*(++cp));

searching for the first NUL in a string.  This is not necessarily a
useful example, but does demonstrate the case.  How do you use the
function/macro?  It requires more statements and is not as clear, to me.
I've been told that I write/understand cryptic C.  This is not cryptic
to me.  It is concise and clear.  What's the objection to using the
language as designed?  Why NOT use features?
-- 
***
*  Steven List @ Benetics Corporation, Mt. View, CA
*  Just part of the stock at "Uncle Bene's Farm"
*  {cdp,greipa,idi,oliveb,sun,tolerant}!bene!luke!itkin
***



More information about the Comp.lang.c mailing list