Re: Operator overloading in C
- From: Flash Gordon <spam@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 05 Sep 2007 18:59:17 +0100
Philip Potter wrote, On 05/09/07 15:19:
jacob navia wrote:The lcc-win compiler is an experimental compiler
freely available at
http://wwww.cs.virginia.edu/~lcc-win32
It features among other enhancements operator overloading.
The specifications for that can be downloaded from:
http://www.q-software-solutions.de/~jacob/proposal.pdf
I would be interested in feedback from this group.
Thanks in advance.
Jacob
To provide some context for those who haven't been following this in comp.lang.c, I believe Jacob is advocating adding operator overloading to standard C, and thinks that the benefits of it far outweigh the downsides. He has made this suggestion a few times in comp.lang.c but the locals suggested that proposals for changing the C standard should be made here rather than there.
Jacob: I suggest you post your proposal rather than link to it, simply because people are more likely to read it if you do this. Also the link seems to be broken - I can't get your proposal at all.
The link works from here. However, I agree it is likely to be more widely read if posted in its entirety.
Re: the need for references to do operator overloading. I don't see why you could not do the definition as:
Type operator=(Type * const arg1,Type arg2);
Obviously behaviour on trying to access anything other than the actual item pointed to and a good quality implementation would warn if you attempted to do that. By the way, yes I am saying make the pointer constant, that is deliberate.
You need to define what you mean by "user defined data types" since you say operator overloading can only be done if one of the types is a user defined data type. Do you mean structures, or any alias created by a typedef or what?
Does the return type have to be one of the two types specified? Can you use different functions depending on what the result is assigned to which, in my opinion, could make reading the code far harder.
I'm not commenting at the moment on whether the extensions are a good idea or not, just suggesting some tightening up that I think you need in your proposal.
--
Flash Gordon
.
- Follow-Ups:
- Re: Operator overloading in C
- From: jacob navia
- Re: Operator overloading in C
- References:
- Operator overloading in C
- From: jacob navia
- Re: Operator overloading in C
- From: Philip Potter
- Operator overloading in C
- Prev by Date: Re: Operator overloading in C
- Next by Date: Re: Operator overloading in C
- Previous by thread: Re: Operator overloading in C
- Next by thread: Re: Operator overloading in C
- Index(es):
Relevant Pages
|