|
From: Keith M. <kei...@to...> - 2005-01-20 11:27:55
|
>> Read and respond to this message at: >> https://sourceforge.net/forum/message.php?msg_id=2947626 >> By: keithmarshall >> >> No, you don't. What you *do* need is a last line which correctly terminates >> with a newline character -- it may, or may not, be blank. > > I just came accross this now as well. Seems that even g++ is complaining > about this. But I simply can't understand the reason of this > requirement. Does the compiler need this newline to desambiguate > something? Or is it just plain BS from the standard? It is a requirement of the standard, which some compilers flaunt. IMHO, it most certainly is *not* BS -- it is a completely worthwhile sanity check. If your last line *doesn't* end with a newline, can you be certain that the file hasn't been corrupted, and that some part of hasn't been chopped off the end? Requiring that the last line ends with a newline increases confidence in the integrity of the file -- of course, it doesn't guarantee it, but the probability of an arbitrarily truncated file actually ending with a newline is fairly low. Regards, Keith. |