Re: operators similar to functions?
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Thu, 29 Nov 2007 12:47:39 -0800
jacob navia <jacob@xxxxxxxxxx> writes:
[...]
Since basically there is no difference between operator usage[...]
and a function call, there are heretics that propose to use the
simpler operator notation instead of the function call notation
to call functions.
Those heretics (that are looked upon with disdain by the law-abiding
regulars of this group) propose a sin called "operator overloading"
where you can use the operator notation to call your own functions,
imagine that.
You write this absolutely heretical notation:
result_type operator+(arg_type a,arg_type b);
Then, with suitable definitions of arg_type, the compiler will call
this function instead of doing a normal addition.
This talk of "heresy" is, of course, complete and utter nonsense.
Operator overloading is neither heretical nor sinful. C is not a
religion. Code that uses features that are not part of standard C is
not sinful, or bad, or even necessarily wrong, it's merely something
other than C.
Ironically enough, operator overloading is actually relevant to the
original poster's question. It's a very nice illustation of how
operators and functions *can* be very similar, and of the fact that
the distinction is more syntactic than semantic (though are are also
some semantic differences). It's a pity that jacob couldn't have made
that point without descending into his usual self-pitying nonsense.
--
Keith Thompson (The_Other_Keith) <kst-u@xxxxxxx>
Looking for software development work in the San Diego area.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- References:
- operators similar to functions?
- From: vlsidesign
- Re: operators similar to functions?
- From: jacob navia
- operators similar to functions?
- Prev by Date: Re: conversion to quadword
- Next by Date: malloc realloc and pointers
- Previous by thread: Re: operators similar to functions?
- Next by thread: Re: operators similar to functions?
- Index(es):
Relevant Pages
|