Path: utzoo!attcan!utgpu!watmath!att!tut.cis.ohio-state.edu!cs.utexas.edu!ico!ism780c!news From: news@ism780c.isc.com (News system) Newsgroups: comp.lang.c Subject: Re: swap(x,y) Message-ID: <33719@ism780c.isc.com> Date: 21 Sep 89 21:31:30 GMT References: <8350@boring.cwi.nl> <14479@haddock.ima.isc.com> <1545@l.cc.purdue.edu> <10897@smoke.BRL.MIL> <604@rwthbs.UUCP> <4151@buengc.BU.EDU> <714@philmtl.philips.ca> Reply-To: marv@ism780.UUCP (Marvin Rubenstein) Organization: Interactive Systems Corp., Santa Monica CA Lines: 32 In article <714@philmtl.philips.ca> ray@philmtl.philips.ca (Raymond Dunn) writes: >This sounds dangerously like the arguments made by Herman Rubin that 'C' >should provide facilities to access all the functionality of the machine >architecture in some direct way. > >Since when was that the goal of *any* language other than assemblers? It used to be the goal. FORTRAN had statements like: IF SENSE SWITCH -- gave access to switches on the operators console SENSE LIGHT -- to turn on a light on the operators console IF OVERFLOW -- gave access to alu overflow state REWIND n -- generated a single machine instruction ABS(X) -- generated a single machine instruction SIGN(A,B) -- the IBM/704 had a shift instruction which had the effect of copying a sign from one register to another. MIN(A,B,...) -- generated two instructions for each operand PAUSE n -- A single instruction, displayed 'n' in lights on the operator console. The operator could continue execution by pressing a start button. PAUSE was intended to be used for console debugging With the exception of REWIND, these 'features' were all put into the language because they were 'easy' to implement and provided direct access to hardware. (I wonder if SIGN is used in any FORTRAN program outside a test suite :-) Since those days, language designers tend to put only generic facilities into the language. One reason C exists on so many machines is that it does NOT have access to the 'features' of a machine. Marv Rubinstein