Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > White space at the end of a line

Reply
Thread Tools

White space at the end of a line

 
 
Spiros Bousbouras
Guest
Posts: n/a
 
      12-03-2007
I'm thinking of adding a command to vim for removing
white space from the end of each line of a C source
file. Can anyone think of a situation where such white
space might be useful ?
 
Reply With Quote
 
 
 
 
vippstar@gmail.com
Guest
Posts: n/a
 
      12-03-2007
On Dec 3, 7:52 pm, Spiros Bousbouras <(E-Mail Removed)> wrote:
> I'm thinking of adding a command to vim for removing
> white space from the end of each line of a C source
> file. Can anyone think of a situation where such white
> space might be useful ?


//\<no-space>
printf("Never called!\n");
//\<space>
printf("Called!\n");
 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      12-03-2007
In article <(E-Mail Removed)>,
<(E-Mail Removed)> wrote:

>> I'm thinking of adding a command to vim for removing
>> white space from the end of each line of a C source
>> file. Can anyone think of a situation where such white
>> space might be useful ?


>//\<no-space>
>printf("Never called!\n");
>//\<space>
>printf("Called!\n");


He said "useful", not "obfuscating"!

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
 
Reply With Quote
 
Spiros Bousbouras
Guest
Posts: n/a
 
      12-03-2007
On Dec 3, 5:58 pm, (E-Mail Removed) wrote:
> On Dec 3, 7:52 pm, Spiros Bousbouras <(E-Mail Removed)> wrote:
>
> > I'm thinking of adding a command to vim for removing
> > white space from the end of each line of a C source
> > file. Can anyone think of a situation where such white
> > space might be useful ?

>
> //\<no-space>
> printf("Never called!\n");
> //\<space>
> printf("Called!\n");


I wouldn't call a construct like

//\<no-space>
printf("Never called!\n");

useful. But thanks for the suggestion.

 
Reply With Quote
 
Richard Harter
Guest
Posts: n/a
 
      12-03-2007
On Mon, 3 Dec 2007 09:52:17 -0800 (PST), Spiros Bousbouras
<(E-Mail Removed)> wrote:

>I'm thinking of adding a command to vim for removing
>white space from the end of each line of a C source
>file. Can anyone think of a situation where such white
>space might be useful ?


Consider

#define foo \<space>
#define foo \<no_space>

The behaviours are different.



Richard Harter, http://www.velocityreviews.com/forums/(E-Mail Removed)
http://home.tiac.net/~cri, http://www.varinoma.com
In the fields of Hell where the grass grows high
Are the graves of dreams allowed to die
 
Reply With Quote
 
Al Balmer
Guest
Posts: n/a
 
      12-03-2007
On Mon, 03 Dec 2007 18:49:22 GMT, (E-Mail Removed) (Richard Harter) wrote:

>On Mon, 3 Dec 2007 09:52:17 -0800 (PST), Spiros Bousbouras
><(E-Mail Removed)> wrote:
>
>>I'm thinking of adding a command to vim for removing
>>white space from the end of each line of a C source
>>file. Can anyone think of a situation where such white
>>space might be useful ?

>
>Consider
>
>#define foo \<space>
>#define foo \<no_space>
>
>The behaviours are different.
>

What Richard Tobin said.

--
Al Balmer
Sun City, AZ
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      12-03-2007
Spiros Bousbouras <(E-Mail Removed)> writes:
> I'm thinking of adding a command to vim for removing
> white space from the end of each line of a C source
> file. Can anyone think of a situation where such white
> space might be useful ?


As others have said, the example presented by vippstar isn't what I'd
call *useful*, except perhaps to determine which programmer to fire.

Before I saw that example, I would have guessed that there's no case
where trailing white space is significant. One exception, sort of, is
that a line-joining \ can't be followed by white space (which is a
dumb rule IMHO), but in that case the white space makes the program
illegal.

However, depending on what text editor you use, it might be convenient
to have blank lines indented by the same amount as the non-blank lines
surrounding them. For example (end-of-line marked with '$'):

int x;$
$
x = 42;$

vs.

int x;$
$
x = 42;$

It makes no difference to the compiler, of course,

--
Keith Thompson (The_Other_Keith) <(E-Mail Removed)>
Looking for software development work in the San Diego area.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Peter Nilsson
Guest
Posts: n/a
 
      12-03-2007
(E-Mail Removed) (Richard Tobin) wrote:
> <(E-Mail Removed)> wrote:
> > > I'm thinking of adding a command to vim for removing
> > > white space from the end of each line of a C source
> > > file. Can anyone think of a situation where such white
> > > space might be useful ?

> >
> >//\<no-space>
> >printf("Never called!\n");
> >//\<space>
> >printf("Called!\n");

>
> He said "useful", not "obfuscating"!


This isn't useful either...

puts("Something with a \\<space>
to illustrate a point.");

--
Peter
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      12-03-2007
Spiros Bousbouras wrote:
>
> I'm thinking of adding a command to vim for removing white space
> from the end of each line of a C source file. Can anyone think of
> a situation where such white space might be useful ?


Yes.

--
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>
Try the download section.


--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
Duncan Muirhead
Guest
Posts: n/a
 
      12-04-2007
On Mon, 03 Dec 2007 09:52:17 -0800, Spiros Bousbouras wrote:

> I'm thinking of adding a command to vim for removing
> white space from the end of each line of a C source
> file. Can anyone think of a situation where such white
> space might be useful ?

I can't, but of course a danger with such file modifications
is that (some) source control systems/patchers might be fooled into
thinking you had made many changes, for which others working
on the same code might not thank you.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any programs to trim white space/ remove all white space in HTML file? Ben C HTML 6 01-28-2007 11:41 PM
prevent line end translate into white space Greg N. HTML 8 07-28-2005 12:25 PM
Replace all white space at the end of a string j1c ASP General 5 12-16-2004 06:06 PM
Why Python style guide (PEP-8) says 4 space indents instead of 8 space??? 8 space indents ever ok?? Christian Seberino Python 21 10-27-2003 04:20 PM
Stack space, global space, heap space Shuo Xiang C Programming 10 07-11-2003 07:30 PM



Advertisments