Help on gcc
Daniel Berlin
dan@dberlin.org
Tue Feb 5 17:39:00 GMT 2002
On Tue, 5 Feb 2002, James Dressler wrote:
> For those that believe in "Free Software": read carefully the e-mails
> exchanged between me and Mr. Oliva, who answers by GCC (a free C++
> Compiler)...
>
> ------------------------------------------------------------------
> Here begins my answer to you, Mr. Oliva:
>
> It's a simple example, only to show the point.
>
> I'm happy to tell you that it's impossible, on a operational system like
> Solaris, Windows NT, Windows 2000, Linux and any other Unix-like system, to
> "destroy the world" using a NULL pointer, because this is a logical address.
Actually, since it's undefined, it could do whatever it wanted to.
It has nothing to do with MMU's.
> There is a Memory Management Unit to map the logical address to physical
> address, what make impossible that using a NULL pointer do any harm.
Sorry, what you did with it is undefined, the compiler can do whatever it
wants as a result.
Period.
> And I'm
> just using a not too much technical language, to make it easier for you to
> understand.
I'm sure you don't need to.
>
> Imagine, for example, that it's not a NULL pointer, but a pointer that
> dereferences an area of memory, previously allocated using "new", that has
> been already returned to the operational system by a "delete" statement. It
> will not work too. No exception raised.
Nor is one required to be.
>
> For your information, although I think you already know, it works on
> Microsoft C++ Compiler, and many others C++ Compilers. To be happy, like you
> said, it's better to go with them.
If you want non-standard behavior that Microsoft C++ gives you,
then use it.
> Probably you think that gcc is a joke,
> something to play with.
No, he doesn't.
> You convinced me.
>
> And I don't see any relation between my sister and C++.
It was, of course, a joke.
> I guess if someone at Microsoft gave me an awful answer like you, what would happen to him.
He'd charge you 300 bucks?
> Probably, he would be fired. That's what you deserve.
>
> Best regards
> James M. Dressler
>
>
> >From: Alexandre Oliva <aoliva@redhat.com>
> >To: "James Dressler" <jamesmdr@hotmail.com>
> >CC: gcc@gcc.gnu.org
> >Subject: Re: Help on gcc
> >Date: 05 Feb 2002 19:10:26 -0200
> >
> >On Feb 5, 2002, "James Dressler" <jamesmdr@hotmail.com> wrote:
> >
> > > does not work, never prints "captured"
> >
> >Dereferencing a NULL pointer invokes undefined behavior, so the crash
> >you get is in perfect accordance with the Standard, and it is indeed
> >the expected behavior. In fact, be happy that the program didn't
> >format your hard disk, destroy the universe nor go out with your
> >sister :-) It might throw an exception, but that's not what most would
> >expect from C++ programs in this situation. C++ != Java :-)
> >
> >--
> >Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
> >Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
> >CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
> >Free Software Evangelist Professional serial bug killer
>
>
>
>
>
> James Masi Dressler
>
> DBKi Software
> ===============
> www.dbki.com.br
> ===============
>
>
> _________________________________________________________________
> Chegou o novo MSN Explorer. Instale já. à gratuito:
> http://explorer.msn.com.br
>
More information about the Gcc
mailing list