Anyone know why gcc( maybe all compilers but i've only got this one ) warns, "warning: no new line at end of file"?
If i dont correct the warning my progs still work ok.
Anyone know why gcc( maybe all compilers but i've only got this one ) warns, "warning: no new line at end of file"?
If i dont correct the warning my progs still work ok.
"Assumptions are the mother of all **** ups!"
Because the format of text files demands a newline at the end of each line. It is possible that some utilities would ignore the last line.
> If i dont correct the warning my progs still work ok.
Probably, but is it really so difficult to just edit the file and put a newline in the proper place?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
No its not difficult, I do it anyway because that warning is just plain annoying. But i was curious as to the reason. Thanks for the explaination.
"Assumptions are the mother of all **** ups!"
Because that is standard?Originally posted by Kinasz
Anyone know why gcc( maybe all compilers but i've only got this one ) warns, "warning: no new line at end of file"?5.1.1.2 Translation phases
2. [...]A source file that is not empty shall end in a new-line character, [...]
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*