Re: An interesting blog



Ben Bacarisse a écrit :
jacob navia <jacob@xxxxxxxxxxxx> writes:

Dennis (Icarus) a écrit :
<snip>
How about foo(m[5]) Same thing right? m[5] is being
assigned/copied/rererenced to the first argument of foo. Thart won't
be helped by defining a new operator.
Look, he wrote:

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.

The C behavior should be an exception
(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 =.
.



Relevant Pages

  • Re: A C++ Whishlist
    ... Java is annoying enough with its exceptions to the operator overloading ... What's the point in "catching" an exception for a statement where you ... "Je ein Stueckchen Kreppsohle an die Fuesse eines Hamsters kleben. ...
    (comp.lang.cpp)
  • Re: UNIX, C, Perl
    ... Nick Keighley wrote: ... snip ... ... how many places can this expression generate an exception? ... especially if operator overloading is present. ...
    (comp.lang.c)
  • Re: A solution for the allocation failures problem
    ... why not just adopt a subset of the C++ exception ... Like throwing specific structs and catch them? ... operator overloading implementation is nothing like C++. ...
    (comp.lang.c)
  • Re: Video Mode 13h in windows XP ... impossible?
    ... >>exception to try to actually access memory using ebx greater than 0FFFFh ... Okay, I see, the "size suffix" can be used with registers too. ...
    (alt.lang.asm)
  • Re: Download file works locally, but not on server - Any idea?
    ... The file path is okay and no exception happens. ... In addition the download page is ... This code works okay when running locally. ...
    (microsoft.public.dotnet.framework.aspnet.security)