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 <vjdc55$1q2to$1@dont-email.me>
Deutsch   English   Français   Italiano  
<vjdc55$1q2to$1@dont-email.me>

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

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: question about linker
Date: Thu, 12 Dec 2024 00:52:53 +0000
Organization: A noiseless patient Spider
Lines: 124
Message-ID: <vjdc55$1q2to$1@dont-email.me>
References: <vi54e9$3ie0o$1@dont-email.me> <vicfra$13nl4$1@dont-email.me>
 <20241129161517.000010b8@yahoo.com> <vicque$15ium$2@dont-email.me>
 <vid110$16hte$1@dont-email.me> <vifcll$1q9rj$1@dont-email.me>
 <vifiib$1s07p$1@dont-email.me> <87ldwx10gv.fsf@bsb.me.uk>
 <vimtt4$27vv$1@dont-email.me> <86ser1kgp5.fsf@linuxsc.com>
 <vit69t$1qfgg$1@dont-email.me> <87ldwtzlc0.fsf@nosuchdomain.example.com>
 <vitjgg$1tukq$2@dont-email.me> <vj1bss$325uo$1@dont-email.me>
 <vj1h4i$335q1$2@dont-email.me> <vjd522$1c9h5$1@paganini.bofh.team>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 12 Dec 2024 01:52:53 +0100 (CET)
Injection-Info: dont-email.me; posting-host="021d91925d3f1b965194e346b20c998a";
	logging-data="1903544"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19i7zSeTnGVojTkYfCrkHLt"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:lBJU6rvwimSkXNOGk/q94HtaEn0=
Content-Language: en-GB
In-Reply-To: <vjd522$1c9h5$1@paganini.bofh.team>
Bytes: 5399

On 11/12/2024 22:51, Waldek Hebisch wrote:
> Bart <bc@freeuk.com> wrote:
>> On 07/12/2024 11:34, Janis Papanagnou wrote:
>>> On 06.12.2024 02:20, Bart wrote:
>>
>>>> I used to be puzzled by this too: 'while' can both start a while
>>>> statement, and it can delimit a do-while statement. How is that possible?
>>>
>>> A keyword (like 'while') is just a lexical token that can be used in
>>> different syntactical contexts.
>>
>> Is it common to both start and end a statememt with the same keyword?
> 
> Technically, 'do' loop ends in a semicolon.

A do-loop ends with:

        while (cond);

A while loop starts with:

        while (cond)

Sometimes a while loop starts and ends with:

        while (cond);

> Concerning "start and end a statememt with the same keyword",
> this is clearly common when statement consist of a single
> symbol, like empty statement in many langages, including C and
> Algol68

I think it's uncommon. In Algol68 you both start and end a comment with 
'comment', or 'co' or '#', which is a spectacularly bad idea. It's easy 
to get them out of step. Or if looking at an isolated delimiter, you 
can't tell, if in the middle of code, whether it is the beginning or end 
of the comment.

> I think it was already noted that this is not a valid C statement.
> 
>      do while(cond) ; while (cond);
> 
> is valid, and indeed may be confusing to humans.  But people
> would normally write it as
> 
>      do {
>          while(cond) ;
>      } while (cond);

That's still pretty confusing! In languages where 'while' doesn't do two 
jobs, you see 'while' and know instantly what it denotes. With C, you 
need to scan outwards from a 'while' to be able to infer from the 
surrounding context whether it is normal while-loop or is part of do-while.

I consider that undesirable.

> or even
> 
>      do {
>          while(cond) {
>             ;
>          }
>      } while (cond);
> 
> to stress that inner loop is "do nothing" loop.  In this form
> structure is clear.


> If you want human-oriented rule for parsing badly written code,
> you may notice that body of a C loop can not be syntactually
> empty, you need at least a semicolon.  So first 'while'
> after 'do' must start an inner loop.

The inner loop might be this:

   do {
      s1;
      while (cond) {}
   } while (cond);

Here, it is now the first { that is fragile. But this is a general 
problem in C with braces, when braces are optional. A missing/extra 
brace might be offset by an extra/missing brace later on. That can 
result in a still-valid structure, but the wrong one.

> Concerning "subtle", note that changing say '*' to '+' can
> signifcantly change parse tree and semantics in almost any
> programming language.  Most people are not bothered by this
> and take care when writing/reading operators.  Similarly
> C programmers are careful when writing/reading semicolons.

; and to a lesser extent {} are regarded as punctuation. The problem is 
more in leaving them out or adding extra ones.

Being generally able to silently make typos is a separate problem that 
occurs everywhere including my language.

But it is not as sensitive as C is to messing up '; { }' because of 
stricter rules on layout, even though it looks more lax:

   repeat
     s1
     while cond do od
   until cond

There are no semicolons or braces to get wrong! Extra semicolons are 
either ignored or give a syntax. I can't even get while/repeat confused 
as they use different keywords.



> You can design a laguage with more redundancy.  For example
> one of languages that I use has
> 
>     if cond then expr1 else expr2 endif
> 
>     while cond do expr endwhile
> 
>     repeat expr endrepeat

OK, I should have read this first. Of course, that's already been done. 
C decided to keep its delicate grammar rather than tighten it up.