[gnu.g++.bug] Funny statement in docs

ngo%tammy@HARVARD.HARVARD.EDU (Tom Ngo) (01/17/90)

I think this declaration, found in the g++ info file in the node
"Function Attributes", looks like a contradiction to me.  Tell me if
I'm wrong:

     extern const void square ();

A function declared "const" has no effect but its return value, no?
A void function returns nothing, no?

--Tom

tiemann@SUN.COM (Michael Tiemann) (01/20/90)

   Date: Tue, 16 Jan 90 22:28:04 EST
   From: ngo%tammy@harvard.harvard.edu (Tom Ngo)


   I think this declaration, found in the g++ info file in the node
   "Function Attributes", looks like a contradiction to me.  Tell me if
   I'm wrong:

	extern const void square ();

   A function declared "const" has no effect but its return value, no?
   A void function returns nothing, no?

   --Tom

Nothing funny about this at all.  The `const' in this example does not
modify `void', it says that the function is `functional', and that cse
can optimize away calls:

	int i = square (a);
	int j = square (b);

	if (i == j)
	  // cse knows this to be true.

Michael