POV-Ray : Newsgroups : povray.off-topic : Games programmers : Re: Games programmers Server Time
7 Sep 2024 07:25:50 EDT (-0400)
  Re: Games programmers  
From: Darren New
Date: 19 Sep 2008 14:38:22
Message: <48d3f19e$1@news.povray.org>
Warp wrote:
>   Since reaching EOF is completely valid, how is the compiler supposed to
> make sure that you write a conditional which takes it into account? 

Some languages can do this, actually, just like some can look at an enum 
and tell you when your switch statement doesn't cover all possibilities. 
:-) It's pretty cool, but certainly not something you could do in a 
language based on the machine level, like C is.

> In fact, returning EOF multiple times is not an error either
> (it can be perfectly possible for different parts of the program to read
> the same file, and all of them get an EOF when there's nothing more to
> read, and all of them still work properly).

Actually, from the keyboard, you can read data, get an eof, read more 
data, and get another eof, just by typing ctrl-D twice.

>   So how is the compiler supposed to make sure that you do the "correct"
> thing when EOF is returned? What *is* the "correct" thing to do?

Not compile a program that tries to read past EOF?

-- 
Darren New / San Diego, CA, USA (PST)


Post a reply to this message

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