POV-Ray : Newsgroups : povray.off-topic : Games programmers : Re: Games programmers Server Time
10 Oct 2024 15:15:58 EDT (-0400)
  Re: Games programmers  
From: Orchid XP v8
Date: 12 Sep 2008 17:20:10
Message: <48cadd0a@news.povray.org>
>> You know what? In Java, if you reference a null pointer, a little 
>> message pops up that says "hey, you just dereferenced a null pointer". 
>> And it even tells you where it happened. In C, your program just behaves 
>> bizarely.
> 
>   Actually no. IIRC the C standard defines that accessing the null pointer
> is illegal (and will usually cause a segmentation fault). If you are running
> a proper debugger, it will tell you the exact line where the null pointer
> was accessed.

I guess it works differently with a real OS. I've only ever compiled C 
code under MS-DOS, and there you don't get "segfaults", you get "my 
program does something really weird which may even require me to reboot 
the whole PC to fix". Pascal programs never, ever did that.

>> Ditto for EOF
> 
>   You mean reaching the end of the file is such a fatal error, that the
> program must be terminated with an exception?

Well, it beats producing random garbage, surely?

>> array index out of bounds
> 
>   Unless you use a proper debugger.

I've never seen a C debugger. Nor would I know where to find one. 
(Although presumably it's a standard tool that a real C programmer would 
know how to find and use.)

>> (And you don't have to memorise whether 0 is true or false.
> 
>   I see how that's such a hard thing to memorize.

There are two possibilities which are apparently equally valid. It's 
very difficult to remember which one of them was arbitrarily selected by 
the language designers.

>> Memory leaks? What memory leaks?
> 
>   Yeah. Java leaks memory constantly. In fact, *everything* is leaked.

I was waiting for that one... ;-)

>> No dangling pointers here either.
> 
>   Except for the null references.

You can still forget to make a pointer point to something, but you can't 
accidentally delete a chunk of memory that's still in use.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.