🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #299

Re: foo() => foo

#299
From: Andrew Koenig
Date: Fri, 03 Aug 1990 14:37
26 lines
1304 bytes
In article <26717@pasteur.Berkeley.EDU>, krste@ICSI.Berkeley.EDU ( Krste Asanovic) writes:

> Suggestion: If a function can be called with no arguments, then it
> should be possible to call it without using the superfluous empty
> parenthesis.

C++ inherits from C the notion that the unadorned name of a function
can be quietly converted to the address of that function.  Allowing
your suggestion would therefore introduce ambiguities.  For example:

	void f(int);
	void f(int (*)());

	int g();

	main()
	{
		f(g);		// what does this do?
	}

As C++ stands now, g can only be interpreted as a pointer to a function
returning int with no arguments.  Under your suggestion, it would
be permitted to call g() as well, thus introducing an amgibuity.
-- 
				--Andrew Koenig
				  ark@europa.att.com
Technical Details
Message-ID: <11130@alice.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!ux1.cso.uiuc.edu!brutus.cs.uiuc.edu!zaphod.mps.ohio-state.edu!mips!pacbell.com!pacbell!att!dptg!ulysses!andante!alice!ark
References: <26717@pasteur.Berkeley.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!ux1.cso.uiuc.edu!brutus.cs.uiuc.edu!zaphod.mps.ohio-state.edu!mips!pacbell.com!pacbell!att!dptg!ulysses!andante!alice!ark
From: ark@alice.UUCP (Andrew Koenig)
Newsgroups: comp.std.c++
Subject: Re: foo() => foo
Keywords: function call syntax
Message-ID: <11130@alice.UUCP>
Date: 3 Aug 90 14:37:08 GMT
References: <26717@pasteur.Berkeley.EDU>
Organization: AT&T Bell Laboratories, Liberty Corner NJ
Lines: 26