Mail Archives: djgpp/2004/02/04/06:46:18
> From: sterten AT aol DOT com (Sterten)
> Newsgroups: comp.os.msdos.djgpp
> Date: 04 Feb 2004 08:50:22 GMT
>
> why should someone want to take a value - and then discard it ?
It is useful when the computation has a side effect. For example:
for (x = 1, y = 0, z = 100; x < 100; x++, y++)
Here the expression "x = 1" yields a value of 1, but it also has a
side effect of assigning 1 to x.
> I mean, if this A[i,j,k] isn't really needed, then can't we
> define it to be A[i][j][k] ?
No, we can't, since the basic syntax of C cannot be changed without
changing the language.
> > #define MA(i,j,k) A[i][j][k]
> >
> >(note the use of parentheses instead of square brackets), or a similar
> >definition of an inline function.
>
> very good !
Actually, not very good because using macros to change a syntactic
appearance of a programming language is generally a bad habit. For
starters, people who read your program will have difficulty
understanding the code. And you yourself prevent yourself from
learning C faster.
- Raw text -