Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: Pascal --> C question
Message-ID: <1988Mar15.020608.1331@utzoo.uucp>
Organization: U of Toronto Zoology
References: <12340@brl-adm.ARPA>, <2351@bsu-cs.UUCP>
Date: Tue, 15 Mar 88 02:06:08 GMT

> 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
