Re: 'C' Operators precedence

Matthew Kirkwood (weejock@ferret.lmh.ox.ac.uk)
Wed, 20 May 1998 19:45:31 +0100 (BST)


On Wed, 20 May 1998, David Todd wrote:

> > And this _without_ optimisation. gcc is right to do this; if a function
> > clobbers registers, then let it do so when the variables don't contain
> > anything interersting anyway.
>
> Umm, the reason why there is a penalty for calling a function (and why
> c++ has inline functions to avoid the penalty) is because calling a
> function pushes all the registers onto the stack, and restores them
> afterward.

That's shite. It is usually the callee's responsibility to save registers
reserved for register variables, but no compiler that I know of saves
_everything_, even aside from clobbering one reg to return a result in.

And while we're on this topic, where in K&R or the ANSI spec does it state
that C is only to be compiled to a register machine anyway?

I was just pointing out that c was designed to allow for this kind of
flexibility; it leaves it open to the implementors to choose sensible
calling and register conventions, etc...

Matthew.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu