From 9002775392921475693
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,9a5d91576ea14293
X-Google-Attributes: gid109fba,public
X-Google-Thread: f78e5,42ca30940288d269
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-03-02 04:14:45 PST
Xref: sparky comp.lang.c++:5476 comp.std.c++:258
Newsgroups: comp.lang.c++,comp.std.c++
Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!magnum.cs.mu.OZ.AU!fjh
From: fjh@magnum.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: Re: X to the Y power, how?
Message-ID: <9206222.13299@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU
Organization: Computer Science, University of Melbourne, Australia
References: <50175@hydra.gatech.EDU> <1992Feb27.135250.25403@ux1.cso.uiuc.edu> <1992Feb27.223558.276@rice.edu> <22292@alice.att.com> <omci1INN8np@agate.berkeley.edu>
Date: Mon, 2 Mar 1992 12:01:04 GMT
Lines: 49

jbuck@forney.berkeley.edu (Joe Buck) writes:

>6.  Why not use ** as in Fortran?

>It would break "int main(int argc,char **argv)".  We can't make ** a
>token.

Joe Buck's proposal is in general very well thought out, and deserves to be
praised.

However, I am SICK TO DEATH of the MANY people posting INCORRECT statements to
the effect that "well, using '**' would be nice, but it is impossible".

It is QUITE possible to provide a simple interface that allows ** to be used as
both for exponentiation and double-indirection.

For example, the following program:

	#include "exponent.h"
	#include <iostream.h>

	int main(int argc, char **argv) {
		printf("Arg count: %d\n", argc);
		printf("Program name: %s\n", argv[0]);

		printf("Yes this REALLY will work: %f\n",
			2.0 ** 3.0 );
	}

will compile and execute giving the desired output.

This requires NO CHANGE TO THE LANGUAGE. All it requires is the appropriate
code in exponent.h, which I leave as an excercise to the reader (only because
I have posted it once already).

[Flame Off]

	Fergus.
                                                                                
------
Fergus Henderson             fjh@mundil.cs.mu.oz.au      
This .signature VIRUS is a self-referential statement that is true - but 
you will only be able to consistently believe it if you copy it to your own
.signature file!
-- 
Fergus Henderson             fjh@mundil.cs.mu.oz.au      
This .signature VIRUS is a self-referential statement that is true - but 
you will only be able to consistently believe it if you copy it to your own
signature file!


