bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cc-mode adds newlines


From: Hallvard B Furuseth
Subject: Re: cc-mode adds newlines
Date: Mon, 22 Nov 2004 20:37:14 +0100

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> The C standard requires a newline.
>
> Where?

C99 5.1.1.2 Translation phases:

2. Each instance of a backslash character (\) immediately followed by
   a new-line character is deleted, splicing physical source lines to
   form logical source lines.  (...) A source file that is not empty
   shall end in a new-line character, which shall not be immediately
   preceded by a backslash character before any such splicing takes
   place.

Phase 2 in C89 had similar text.

>> Regardless of standards, there are tools out there which do not behave
>> properly if a file does not end in a newline.
>
> Yup.  A good reason to set require-final-newlnie to `ask'.

One of the good things about Emacs compared to other "user-friendly"
things out there was once that one didn't have to tell it "yes, I really
mean that and you really don't know better than me" all the time.

>> And finally, I have a very hard time imagining a situation where it's
>> important to _NOT_ have a final newline in a text file, especially
>> a C source file
>
> Come on, that's easy.  Think of the usual "proof by diagonalization".
> I.e. one such situation is when you want to find out if the tool
> misbehaves in the absence of a final newline.

Or, like I said, if it's a file name which ends with .c or .h but is
not a C source file.  Filename extension collisions do happen at times.

-- 
Hallvard




reply via email to

[Prev in Thread] Current Thread [Next in Thread]