Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <vpps7v$34tq7$1@dont-email.me>
Deutsch   English   Français   Italiano  
<vpps7v$34tq7$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: Which code style do you prefer the most?
Date: Thu, 27 Feb 2025 14:18:40 +0000
Organization: A noiseless patient Spider
Lines: 70
Message-ID: <vpps7v$34tq7$1@dont-email.me>
References: <vpkmq0$21php$1@dont-email.me> <vplhc7$26ur1$3@dont-email.me>
 <87v7swzzl7.fsf@onesoftnet.eu.org> <vpn4qi$2j0hq$1@dont-email.me>
 <vpo20n$2o9ks$1@dont-email.me> <vpo7ec$2ovro$1@dont-email.me>
 <87a5a7k0ko.fsf@onesoftnet.eu.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 27 Feb 2025 15:18:39 +0100 (CET)
Injection-Info: dont-email.me; posting-host="c63d44fe64e4407b317d5d63cf1d70ab";
	logging-data="3307335"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/q4f1VVzFtN1rV4Sek1aU+"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ihYh8HQ71/M8tswVBvwsX6CHXuE=
In-Reply-To: <87a5a7k0ko.fsf@onesoftnet.eu.org>
Content-Language: en-GB

On 27/02/2025 12:56, Ar Rakin wrote:
> bart <bc@freeuk.com> writes:
> 
>> // isn't devoid of quirks (this is still C after all), for example:
>>
>>     fopen(file,"rb");   // open file in \windows\system32\
>>     fread(...);
>>
>> Here, the // line continues onto the next, so that the fread is
>> commented out. But they are fewer.
> 
> Interesting. Isn't this considered a compiler bug?

It's to do with how C is defined, which requires that its implementation 
corresponds to series of phases.

Then line-splicing, which combines two lines if the first ends with \, 
is done before processing // comments.

  I am aware that you
> can do the same thing with strings like this:
> 
> fprintf(stderr, "multi\
> line\
> strings\
> are fun.");
> 
> I can understand how this might be useful; but with *comments*?? Was
> that actually a thing in the official C standards?

It's isn't that useful for strings; the following is simpler and also works:

   "multi"
   "line"
   "string"

But it is needed for multi-line macros, as C's proprocessor is strictly 
line-oriented and a macro definition must fit onto one line.

So lines spliced with \ can be used to combine multiple lines into one. 
A side-effect is that you can't use // comments for individual lines of 
a multi-line macro, it would screw things up.

> To me it just feels like a compiler bug that was never fixed.

To me the whole of C feels like one huge language bug!

The way line splicing works has even weirder repercussions; any token 
can be split across lines:

i\
n\
t abc;      // split 'int' across 3 lines

/\
/ This is a '//' comment with // split across two lines

/\
* This is a /* ... comment */

"ABC\\
nDEF"      // A split string escape code

if (a =\
= b) ...

In fact, any C source file can be written with one character per line, 
plus the \ line continuation.