Re: C FAQ 3.1
- From: mwojcik@xxxxxxxxxxx (Michael Wojcik)
- Date: 26 Apr 2005 15:39:26 GMT
In article <pan.2005.04.26.12.56.34.141000@xxxxxxxxxxxxxxx>, Lawrence Kirby <lknews@xxxxxxxxxxxxxxx> writes:
> On Tue, 26 Apr 2005 12:04:15 +0000, Stan Milam wrote:
> >
> > Because it would clear up a lot of confusion, specify exactly what the
> > behavior should be. I am convinced we have undefined behavior because
> > K&R were too lazy or in a hurry to specify exactly what should happen in
> > these now undefined cases.
>
> It is more likely because this freedom gives compilers extra scope for
> optimisation. On some architectured the natural calling sequence might
> favour left to right evaluation of arguments, on another ot might be right
> to left. Some optimisers might find advantages in other arrangements.
In fact, with modern processors, it's quite likely that the optimal
order of evaluation for some function calls will depend on what else
is happening in the surrounding code, so the order might be different
for different calls in a given TU.
With OOE processors and write-back memory caching, it's possible that
even the compiler doesn't know what order evaluation will actually
effectively take place. Should C compilers be forced to insert memory
barriers in code that evaluates function parameters, just so the
order of evaluation can be specified?
I suspect Stan's conviction is way off base, and both K&R and the
committee had excellent reasons for not defining what happens in
every situation.
--
Michael Wojcik michael.wojcik@xxxxxxxxxxxxxx
Company Secretary Finance Manager
1) Half-grey haired executives.
2) Must be waist-deep in their field of activities.
3) Must be having the know-how and the do-how of the latest
developments in their respective fields.
-- from "Appointments Vacant" section of Business India
.
- Follow-Ups:
- Re: C FAQ 3.1
- From: Stan Milam
- Re: C FAQ 3.1
- References:
- C FAQ 3.1
- From: ccwork
- Re: C FAQ 3.1
- From: Peter Nilsson
- Re: C FAQ 3.1
- From: Stan Milam
- Re: C FAQ 3.1
- From: Lawrence Kirby
- C FAQ 3.1
- Prev by Date: Re: sequence point
- Next by Date: Re: How to get file size?
- Previous by thread: Re: C FAQ 3.1
- Next by thread: Re: C FAQ 3.1
- Index(es):
Relevant Pages
|