Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #170327
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: deprecate backslash-newline (line continuation) ? |
| Date | 2023-05-22 15:12 -0700 |
| Organization | None to speak of |
| Message-ID | <87a5xw10dp.fsf@nosuchdomain.example.com> (permalink) |
| References | <7ad3c6f6-e8f1-4482-8e06-4f4e85ba32f3n@googlegroups.com> |
Thiago Adams <thiago.adams@gmail.com> writes:
> In C, the line continuation works as if deleted in the first stages
> of compilation.
> So in C it can be in ANY position.
> For instance
>
> #define M\
> ACRO 1
> MACRO 1
>
> // a b \
> c
>
> I think this should be removed from C!
> The only reason to use line continuation is at end of macros.
>
> #define A 1,\2,\
> 3
>
> To implement this is C we can make backslash-newline
> a token. This token will naturally not be allowed in many places.
> And at preprocessor, inside
> #define (maybe also #if) it is considered as blank token.
>
>
> What do you think?
> Do you know any other usage of line continuation other
> than macro?
I would oppose this change. It would break *way* too much existing
code. Kaz points out that C code can be transformed to limit line
length by a simple filter.
Before C89/C90 introduced string literal concatenation, line splicing
was commonly used for long string literals. There's probably still
code that does that.
One change I'd support is to specify that a backslash at the end
of a line may optionally be followed by whitespace. Currently,
in translation phase 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.
So if a line ends with a backslash followed by a space, it's *not*
spliced (in principle), though the line appears identical to one without
the trailing space. (gcc and clang perform the line splice even if
there's trailing whitespace, which is IMHO reasonable but not
conforming.)
A new feature that I wouldn't mind seeing is a way to define a
multi-line macro without need for line splicing, for example:
#defmacro FOO(n)
((n) + 1)
#endmacro
But I'm not convinced this would be worth the effort.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-22 05:19 -0700
Re: deprecate backslash-newline (line continuation) ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-05-22 16:30 +0100
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-22 11:14 -0700
Re: deprecate backslash-newline (line continuation) ? David Brown <david.brown@hesbynett.no> - 2023-05-22 21:46 +0200
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-22 13:06 -0700
Re: deprecate backslash-newline (line continuation) ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-05-22 22:15 +0100
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-22 15:10 -0700
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-22 15:56 -0700
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-22 17:45 -0700
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-22 17:47 -0700
Re: deprecate backslash-newline (line continuation) ? Öö Tiib <ootiib@hot.ee> - 2023-05-23 01:24 -0700
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-23 03:59 -0700
Re: deprecate backslash-newline (line continuation) ? Bart <bc@freeuk.com> - 2023-05-23 16:51 +0100
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-23 10:40 -0700
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-23 11:07 -0700
Re: deprecate backslash-newline (line continuation) ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-05-23 13:31 -0700
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-22 11:29 -0700
Re: deprecate backslash-newline (line continuation) ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-05-22 22:18 +0100
Re: deprecate backslash-newline (line continuation) ? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-07-20 09:14 -0700
Re: deprecate backslash-newline (line continuation) ? David Brown <david.brown@hesbynett.no> - 2023-05-22 17:31 +0200
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-22 11:17 -0700
Re: deprecate backslash-newline (line continuation) ? David Brown <david.brown@hesbynett.no> - 2023-05-22 21:52 +0200
Re: deprecate backslash-newline (line continuation) ? Öö Tiib <ootiib@hot.ee> - 2023-05-22 09:10 -0700
Re: deprecate backslash-newline (line continuation) ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-05-22 19:10 +0000
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-22 12:25 -0700
Re: deprecate backslash-newline (line continuation) ? David Brown <david.brown@hesbynett.no> - 2023-05-22 21:58 +0200
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-22 13:21 -0700
Re: deprecate backslash-newline (line continuation) ? scott@slp53.sl.home (Scott Lurndal) - 2023-05-22 20:15 +0000
Re: deprecate backslash-newline (line continuation) ? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-05-22 15:12 -0700
Re: deprecate backslash-newline (line continuation) ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-05-23 06:57 +0000
Re: deprecate backslash-newline (line continuation) ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-05-23 00:13 -0700
Re: deprecate backslash-newline (line continuation) ? Blue-Maned_Hawk <bluemanedhawk@gmail.com> - 2023-05-23 20:40 -0400
Re: deprecate backslash-newline (line continuation) ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-05-24 02:05 +0100
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-23 19:07 -0700
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-23 19:09 -0700
Re: deprecate backslash-newline (line continuation) ? Richard Damon <Richard@Damon-Family.org> - 2023-05-24 12:07 -0400
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-23 19:34 -0700
Re: deprecate backslash-newline (line continuation) ? Blue-Maned_Hawk <bluemanedhawk@gmail.com> - 2023-05-23 22:32 -0400
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-23 19:44 -0700
Re: deprecate backslash-newline (line continuation) ? Thiago Adams <thiago.adams@gmail.com> - 2023-05-23 19:08 -0700
csiph-web