From 6965045045196550981
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,9a6b7da9ba54eaea
X-Google-Attributes: gid109fba,public
X-Google-Thread: f78e5,9a6b7da9ba54eaea
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1993-07-06 12:05:59 PST
Xref: gmd.de comp.lang.c++:25873 comp.std.c++:2978
Path: gmd.de!xlink.net!howland.reston.ans.net!agate!agate!matt
From: matt@physics2.berkeley.edu (Matt Austern)
Newsgroups: comp.lang.c++,comp.std.c++
Subject: Re: C++ Language Extensions
Date: 6 Jul 93 12:00:27
Organization: Lawrence Berkeley Laboratory (Theoretical Physics Group)
Lines: 25
Message-ID: <MATT.93Jul6120027@physics2.berkeley.edu>
References: <25697@alice.att.com> <25699@alice.att.com> <20evjs$b77@babbage.ece.uc.edu>
	<1993Jun27.155845.28679@ucc.su.OZ.AU>
	<KANZE.93Jul5144659@slsvdnt.us-es.sel.de>
Reply-To: matt@physics.berkeley.edu
NNTP-Posting-Host: physics2.berkeley.edu
In-reply-to: kanze@us-es.sel.de's message of 5 Jul 93 14:46:59

In article <KANZE.93Jul5144659@slsvdnt.us-es.sel.de> kanze@us-es.sel.de (James Kanze) writes:

[referring to a proposed exponentiation operator for C++]

> In sum, the committee has decided to do the hard part (handling the
> difficulties in definition, which will be necessary for the library
> function too), and forgo the easy part (extending the syntax).

The hard part, and also the important part.  There were two reasons
why I wanted an exponentiation operator: to provide more convenient
syntax, and to provide a good method for raising numbers to small
integral powers.  (I *do* hope that none of you write pow(x,2) when
you want to square x...  I've seen code that does this.)

The convenient syntax would have been nice, but overloading pow() for
the case where the second argument is integral will at least remove a
rather large deficiency in the language.  I'm glad that the Committee
approved of the idea of making this addition to the Standard Library.
I hope that this does happen when the time actually comes to make the
Standard Library standard, and that compiler vendors will start
including pow(double,int) in their libraries some time soon.  I'm
getting tired of writing "inline double square(double x) {return x*x;}".
--
Matthew Austern                       Maybe we can eventually make language a
matt@physics.berkeley.edu             complete impediment to understanding.


