🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Martin Hitz Wed, 26 Jun 1991 13:30
Argument Matching
#1341
Author: Martin Hitz
Date: Wed, 26 Jun 1991 13:30
36 lines
1523 bytes
I have been looking for an example for the usefulness of the
"strictly better match" rule in the context of overloading resolution.
The ARM gives one on pages 314-315 (section 13.2), however, I am wondering
if it was possible to rewrite it in a "class-free" manner.

I came up with the following:

	int f(void*, void*);		// =: 1
	int f(const int*, int*);	// =: 2
	int f(int *, const int*);	// =: 3

	int i = f(0,0);
	
The best match sets are {1,3} for the first, and {1,2} for the second argument.
The intersection is {1} (unique), however, 1 is NOT a strictly better match
than 2 (therefore, the call is illegal), because (comparing 1 to 2):

	0 -> void*	is considered equal to		0 -> const int*	
	0 -> void*	is considered equal to		0 -> int*	
	
although

	0 -> int*	is considered BETTER to		0 -> const int*	
	
during the first step (computation of "best" match sets).

I have two questions:

1) Is the example valid?

if yes:	2a) Is the argumentation correct?
if no:	2b) Is there a valid "class-free" example?

Thank you!

	Martin Hitz@csi.uottawa.ca
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads