Re: 'C' Operators precedence

Richard B. Johnson (
Wed, 20 May 1998 09:22:47 -0400 (EDT)

On Tue, 19 May 1998, Todd Larason wrote:

> On Wed, May 20, 1998 at 05:24:16AM +0100, Matthew Kirkwood wrote:
> > On Tue, 19 May 1998, Richard B. Johnson wrote:
> > > This is also the reason why calling a function through a
> > > pointer must use 'extra' parenthesis:
> > >
> > > r = (*f)(a);
> But, um, it doesn't. Assuming 'f' is a simple variable, not a more
> complicated expression, that could just be
> r = f(a);

I am going to answer this thread only once.

Read a text like:
C:Step-by-Step, Waite & Prata, The White Group, Howard W Sams Publ.
ISBM 0-672-22651-0
Page 500, 14.2
Quote "
pfun = atof;
you can use this call to invoke the atof() function:
Some C compilers have allowed the following usage when pfun is a
pfun(string) /* rogue usage */
Note:Neither ANSI C nor K&R C supports this form.
" End quote.

Page 124, Table 5.1 Operators in Order of Decreasing Precedence.
Page 124, Precedence and the Order of Evaluation.

This is a "Beginners" Text. It tells what 'C' is, what the rules are
and how it is supposed to used.

What happens, is too many people start "understanding" what, in fact
isn't true. My reference to 'objects' has nothing to do with the C++
corruption of the term. Object means anything referenced. I could not use
the word "variable", because this would exclude constants which are also

Before everybody in the world claims I'm wrong, I'd suggest that a few
hardy souls read and understand the basics. It would be nice if one
or two said; "I remember learning something about that in school ...".

The order or evaluation is not guaranteed if an operand is not shared.
An important example is shown on page 124. If I had a scanner, I'd
include the text here. Basically they have:
Quote "
y = 8 * 12 + 5 * 20;
Precedence tells us how to establish the order of evaluation when two
operators share an operand. For example, the 12 is an operand for both
the * and the + operators, and precedence tells us that multiplication
comes first. Simularily, precedence tells us that 5 is to be multiplied,
not added. In short, the multiplications, 6 * 12 and 5 * 20 take place
before any addition. What precedence does not establish is which of
these two multiplications occurs first. C leaves that choice to the
implementor,..........." End quote.

This is all very basic stuff.

Dick Johnson
Penguin : Linux version 2.1.101 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to