Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!cornell!rochester!ur-tut!sunybcs!boulder!hao!ames!amdcad!sun!pitstop!sundc!hqda-ai!yendor!fujiirm From: fujiirm@yendor.UUCP (Roger Fujii) Newsgroups: comp.lang.c Subject: Re: Power operator? Message-ID: <52@yendor.UUCP> Date: 8 Jan 88 20:30:42 GMT References: <47000029@uxe.cso.uiuc.edu> <10063@mimsy.UUCP> <646@l.cc.purdue.edu> Organization: Applied Computing Technology, Reston, VA Lines: 49 In article <646@l.cc.purdue.edu>, cik@l.cc.purdue.edu (Herman Rubin) writes: > In article <10063@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes: > > > > #include > > ... > > double a, x; > > ... > > a = pow(x, 7.); > > I think everyone should consider this unsatisfactory. I suppose that strcpy, strcmp... are also unsatisfactory also. > One reason is that requiring the writing of a subroutine call is that > this requires people to use that notation instead of writing > > x = y ** z or x = y ! z. > > Similar thinking would require one to write x = sub(y, z) instead of > x = y - z. This is a major design flaw in all HLLs which I know. Depends on what point of view. From a mathematical point of view, sure. But then, from a mathematical point of view, variable assignment (x = 1) makes no sense either (unless x never changes), even though its meaning is obvious in most programming languages. I think a *lot* of people are forgetting/misunderstanding exactly what 'c' is. C is basically an "abstract assember". All the actual language knows about are data types (ints, floats, doubles, structs...), certain *ELEMENTARY* operators (+, -, *, /, data copy, data compare..... - things that have a fair probability of having an assember equivalent), and control statements (ifs, gotos, subroutine calls...). [ I know this is a *gross* simplification, but this is what I think a fair assement of the language is ]. *EVERYTHING* else is done via function call. Therefore, having pow() makes much more *sense* than having a ** (this is not to say that it makes more intuitive sense, but rather that knowing the language, you would not expect the compiler to do this). I really don't think "well, FORTRAN has it" is really a valid reason for mucking up the language. This is not to say I do not want the language changed, but rather that I would like to see it changed within its "scope" or flavor, rather than because people want to make it look like another language. -- Roger Fujii - ACT, Reston, VA Phone: (703)471-9433 Internet: fujiirm@cml.rpi.edu UUCP: ..!{mimsy,sundc}!{prometheus,hqda-ai}!yendor!fujiirm