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.
Printable View
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.
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?
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.
Although I didn't insert new line at the end of source code, I have never got this warning. I don't know that.
Is that an issue copying from DOS with ``^M'' as a line terminator?
Because that is standard?Quote:
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"?
Quote:
5.1.1.2 Translation phases
2. [...]A source file that is not empty shall end in a new-line character, [...]