Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site reed.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!harpo!decvax!tektronix!reed!alexis From: alexis@reed.UUCP (Alexis Dimitriadis) Newsgroups: net.bizarre Subject: Re: Bizarre Code Message-ID: <1876@reed.UUCP> Date: Sat, 7-Sep-85 06:41:09 EDT Article-I.D.: reed.1876 Posted: Sat Sep 7 06:41:09 1985 Date-Received: Mon, 9-Sep-85 04:04:31 EDT References: <490@moncol.UUCP> <593@grkermi.UUCP> <194@laidbak.UUCP> Reply-To: alexis@reed.UUCP (Alexis Dimitriadis) Organization: Reed College, Portland, Oregon Lines: 35 Summary: > >>Ulp! By any chance did this FORTRAN let you change the value of a constant > >>by passing it to a subroutine, as in: > >> > >> CALL FOO(2) > >> . > >> . > >> SUBROUTINE FOO(I) > >> I=I + 2 > >> RETURN > >> END > >> Now that we all had our laughs at the stupidity of FORTRAN, try running the following code through your favorite C compiler: --------------- char * yes() { return "yes"; } main() { strcpy(yes(), "no"); puts(yes()); } --------------- Sure enough, it prints "no". (Unless you make the data section read-only, of course, which will give you a _run_time_ error). - Alexis -- _______________________________________________ As soon as I get a full time job, the opinions expressed above will attach themselves to my employer, who will never be rid of them again. alexis @ reed {decvax,ihnp4,ucbcad,uw-beaver}!tektronix!reed.UUCP