emacs-devel
[Top][All Lists]
Advanced

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

Re: Sv: Is this a bug in while-let or do I missunderstand it?


From: tomas
Subject: Re: Sv: Is this a bug in while-let or do I missunderstand it?
Date: Mon, 11 Nov 2024 13:23:43 +0100

On Mon, Nov 11, 2024 at 08:49:39AM +0000, arthur miller wrote:

[...]

> Actually didn't know we can introduce new variable in while declaration in
> C++; in C it is verbotten:
> 
> ~/repos/test $ gcc -o test test.c
> test.c: In function 'main':
> test.c:3:10: error: expected expression before 'int'
>     3 |   while (int i = 0) {
>       |          ^~~
> test.c:4:5: error: 'i' undeclared (first use in this function)
>     4 |     i++;
>       |     ^
> test.c:4:5: note: each undeclared identifier is reported only once for each 
> function it appears in

AFAIK, it is erlaubt since C99.

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

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