operator functions and classes (was Re: Time to standardize "true" and "false")

Michael Portuesi portuesi at tweezers.esd.sgi.com
Mon Sep 25 18:27:44 AEST 1989


In article <1989Sep22.073138.19684 at lth.se> newsuser at lth.se (LTH network news server) writes:

   We cannot define our own operator functions on
   the boolean data type, because one of the arguments must be a class object.

	   boolean operator == (boolean x, boolean y) {...}	// error

   I do not understand exactly why this restriction is required, but apparently
   it is.  Please enlighten me.


I'm pretty sure the reason why one of the arguments must be a class
object is to prevent the redefintion of operator functions for base
types such as int, float and char.

				--M

--
__
\/  Michael Portuesi	Silicon Graphics Computer Systems, Inc.
			portuesi at SGI.COM

"The best length for television programs is either 30 seconds or 8
hours." David Byrne



More information about the Comp.lang.c mailing list