[Top][All Lists]

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

Re: cc-mode adds newlines

From: Alan Mackenzie
Subject: Re: cc-mode adds newlines
Date: Sun, 21 Nov 2004 21:47:02 +0000 (GMT)


On Sun, 21 Nov 2004, Richard Stallman wrote:

>    An equally valid argument is that of the programmer who hacks through the
>    night and sets off a build (which takes several hours to complete), goes
>    home for some sleep, then comes back into the office the following
>    afternoon.  He then finds that the build failed for lack of a final
>    newline in one of the files.  Then he expostulates "FAQ!  Why couldn't
>    that stupid editor have put that stupid newline in for me?".

>He should use GCC--then this will never happen.


Actually, in my (paid) work, our project got hit recently by a GCC
newlines problem:  A string which was sent as a command from one box
along a comms channel to another box had an embedded newline in it.  This
was fine and worked.  That is, it worked until a mix up with our
proprietory version control system, so that one day we got the source
code with "proprietory" line terminators.  It compiled without errors or
warnings.  The command string with the proprietory EOL _didn't_ work.  It
didn't cause an error message either, since it was still valid syntax
(yes, that's a design bug on our part.)  It took us ~40 hours of work to
track it down.  :-(

Accepting such strings is a violation of the C++ standard, I think.  I'll
need to complain about this to GCC.  Possibly, I'll not be the first.


>It would be useful to warn about missing final newlines in C, but Emacs
>should not by default add them blindly.

It's good to get such firm guidance.  Thanks.  I'll forward this to
Martin (assuming he hasn't got the message some other way), and maybe we
can bring out a CC Mode 5.30.10 with this in it "quite soon".

Alan Mackenzie (Munich, Germany)

reply via email to

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