Pascal --> C question

Henry Spencer henry at utzoo.uucp
Tue Mar 15 12:06:08 AEST 1988


> Another interesting optimization done by a VMS compiler, that competing
> vendors never thought of doing, is this.  If your C program contains
> 
>      fflush(stdout);
> 
> the VMS C compiler will optimize this into:
> 
>      if (F$MODE == INTERACTIVE)       /* if interactive run */
>         fflush(stdout);
>      else
>         printf("\n");                 /* if batch run */

Probably competing vendors never thought of doing it because it's **WRONG**.
Fflush has no business adding newlines, ever, and an fflush need not be
interactive to be legitimate.  VMS C is broken.
-- 
Those who do not understand Unix are |  Henry Spencer @ U of Toronto Zoology
condemned to reinvent it, poorly.    | {allegra,ihnp4,decvax,utai}!utzoo!henry



More information about the Comp.lang.c mailing list