Re: An interesting blog
- From: jacob navia <jacob@xxxxxxxxxxxx>
- Date: Sun, 25 Jul 2010 20:31:22 +0200
Ben Bacarisse a écrit :
jacob navia <jacob@xxxxxxxxxxxx> writes:The C behavior should be an exception
Dennis (Icarus) a écrit :<snip>How about foo(m[5]) Same thing right? m[5] is beingLook, he wrote:
assigned/copied/rererenced to the first argument of foo. Thart won't
be helped by defining a new operator.
when I write m[5] and there's no m[5], I think there are only two
things that are okay to happen.
Either m[5] returns NULL (a passive indicator that there is no m[5],
like you'd expect from C) or m[5] throws an exception (an aggressive
indicator that there is no m[5], like you'd see in python).
What is so difficult to understand there?
There is a C point here. The original author (at least I think this is
a quote) is mistaken about C. If m[5] does not exist, it would be
wrong to expect NULL.
(exception address violation).
In my implementation, overloading of the operator [] can throw an exception
if you define it like that.
I quoted the blog because it confirms my implementation of operator overloading
using the []= operator as a different operator than [] and =.
.
- Follow-Ups:
- Re: An interesting blog
- From: Richard Bos
- Re: An interesting blog
- References:
- An interesting blog
- From: jacob navia
- Re: An interesting blog
- From: Dennis \(Icarus\)
- Re: An interesting blog
- From: jacob navia
- Re: An interesting blog
- From: Ben Bacarisse
- An interesting blog
- Prev by Date: Re: An interesting blog
- Next by Date: Re: C Standard Regarding Null Pointer Dereferencing
- Previous by thread: Re: An interesting blog
- Next by thread: Re: An interesting blog
- Index(es):
Relevant Pages
|