Optimization (was Re: volatile)

der Mouse mouse at mcgill-vision.UUCP
Mon May 16 17:52:08 AEST 1988


In article <258 at ateng.UUCP>, chip at ateng.UUCP (Chip Salzenberg) writes:
> In article <13074 at brl-adm.ARPA> dsill at NSWC-OAS.arpa (Dave Sill) writes:
>> This bears repeating.  There should be no circumstances under which
>> the semantics of the language are changed by a flag to the compiler.

Like -D?  -I?  -R?  -fsingle?

> This statement is, in my opinion, usually true.  However, [the
> semantics of C aren't simple].  For example, Dave may consider:

> 	a = b;
> 	a = b;

> to mean "move data from b to a twice", which is what a simple C
> compiler might do.  On the other hand, some people -- myself included
> -- consider that same C fragment to mean "assign b's value to a, then
> assign b's value to a", which is redundant and subject to
> optimization.

As far as I can tell, those two meanings are exactly the same thing,
stated two slightly different ways.  The second one is not redundant if
either a or b is volatile; and if neither is volatile, then the first
one *is* redundant and subject to optimization.

					der Mouse

			uucp: mouse at mcgill-vision.uucp
			arpa: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list