Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Win95 is not a virus; a virus does something. -- unknown source


devel / comp.lang.c / Re: C23 (C2x) changes

SubjectAuthor
* C23 (C2x) changesMehdi Amini
+* Re: C23 (C2x) changesDavid Brown
|`- Re: C23 (C2x) changesMehdi Amini
+* Re: C23 (C2x) changesJohn Bode
|+* Re: C23 (C2x) changesDavid Brown
||+* Re: C23 (C2x) changesBart
|||+- Re: C23 (C2x) changesScott Lurndal
|||+* Re: C23 (C2x) changesDavid Brown
||||+* Re: C23 (C2x) changesBart
|||||`* Re: C23 (C2x) changesDavid Brown
||||| `* Re: C23 (C2x) changesBart
|||||  +- Re: C23 (C2x) changesKeith Thompson
|||||  `* Re: C23 (C2x) changesDavid Brown
|||||   +* Re: C23 (C2x) changesBart
|||||   |+- Re: C23 (C2x) changesKeith Thompson
|||||   |`* Re: C23 (C2x) changesDavid Brown
|||||   | `* Re: C23 (C2x) changesBart
|||||   |  `* Re: C23 (C2x) changesDavid Brown
|||||   |   `- Re: C23 (C2x) changesBart
|||||   `* Re: C23 (C2x) changesIan Pilcher
|||||    `- Re: C23 (C2x) changesScott Lurndal
||||`* Re: C23 (C2x) changesBart
|||| +* Re: C23 (C2x) changesScott Lurndal
|||| |+- Re: C23 (C2x) changesLew Pitcher
|||| |`* Re: C23 (C2x) changesTim Rentsch
|||| | `- Re: C23 (C2x) changesBranimir Maksimovic
|||| `- Re: C23 (C2x) changesKeith Thompson
|||`* Re: C23 (C2x) changesManfred
||| +* Re: C23 (C2x) changesBen Bacarisse
||| |`* Re: C23 (C2x) changesManfred
||| | +- Re: C23 (C2x) changesantispam
||| | `* Re: C23 (C2x) changesTim Rentsch
||| |  `* Re: C23 (C2x) changesBranimir Maksimovic
||| |   `* Re: C23 (C2x) changesKeith Thompson
||| |    `* Re: C23 (C2x) changesBranimir Maksimovic
||| |     `* Re: C23 (C2x) changesKeith Thompson
||| |      `* Re: C23 (C2x) changesBranimir Maksimovic
||| |       `* Re: C23 (C2x) changesKeith Thompson
||| |        `* Re: C23 (C2x) changesBranimir Maksimovic
||| |         +* Re: C23 (C2x) changesKeith Thompson
||| |         |`- Re: C23 (C2x) changesBranimir Maksimovic
||| |         `* Re: C23 (C2x) changesDavid Brown
||| |          `* Re: C23 (C2x) changesBranimir Maksimovic
||| |           `* Re: C23 (C2x) changesKeith Thompson
||| |            +- Re: C23 (C2x) changesBranimir Maksimovic
||| |            `* Re: C23 (C2x) changesTim Rentsch
||| |             `- Re: C23 (C2x) changesBranimir Maksimovic
||| `- Re: C23 (C2x) changesBranimir Maksimovic
||`* Re: C23 (C2x) changesBart
|| `* Re: C23 (C2x) changesLew Pitcher
||  +- Re: C23 (C2x) changesBart
||  `* Re: C23 (C2x) changesLew Pitcher
||   `- Re: C23 (C2x) changesBart
|`* Re: C23 (C2x) changesFlorian Weimer
| +- Re: C23 (C2x) changesGuillaume
| `- Re: C23 (C2x) changesKeith Thompson
+* Re: C23 (C2x) changesWilliam Ahern
|`* Re: C23 (C2x) changesTim Rentsch
| `- Re: C23 (C2x) changesBranimir Maksimovic
+* Re: C23 (C2x) changesGuillaume
|`* Re: C23 (C2x) changesPhilipp Klaus Krause
| `* Re: C23 (C2x) changesKeith Thompson
|  +* Re: C23 (C2x) changesBart
|  |`- Re: C23 (C2x) changesThiago Adams
|  `- Re: C23 (C2x) changesGuillaume
+* Static bounds checking (was Re: C23 (C2x) changes)William Ahern
|+* Re: Static bounds checking (was Re: C23 (C2x) changes)David Brown
||`- Re: Static bounds checking (was Re: C23 (C2x) changes)Philipp Klaus Krause
|`* Re: Static bounds checking (was Re: C23 (C2x) changes)Branimir Maksimovic
| +* Re: Static bounds checking (was Re: C23 (C2x) changes)Philipp Klaus Krause
| |`* Re: Static bounds checking (was Re: C23 (C2x) changes)Branimir Maksimovic
| | `- Re: Static bounds checking (was Re: C23 (C2x) changes)Philipp Klaus Krause
| `* Re: Static bounds checking (was Re: C23 (C2x) changes)Bonita Montero
|  `* Re: Static bounds checking (was Re: C23 (C2x) changes)Branimir Maksimovic
|   +* Re: Static bounds checking (was Re: C23 (C2x) changes)Philipp Klaus Krause
|   |+- Re: Static bounds checking (was Re: C23 (C2x) changes)Branimir Maksimovic
|   |`- Re: Static bounds checking (was Re: C23 (C2x) changes)antispam
|   `* Re: Static bounds checking (was Re: C23 (C2x) changes)Bonita Montero
|    `* Re: Static bounds checking (was Re: C23 (C2x) changes)Branimir Maksimovic
|     +* Re: Static bounds checking (was Re: C23 (C2x) changes)Kaz Kylheku
|     |`- Re: Static bounds checking (was Re: C23 (C2x) changes)Branimir Maksimovic
|     `- Re: Static bounds checking (was Re: C23 (C2x) changes)Bonita Montero
+* Re: C23 (C2x) changesThiago Adams
|`* Re: C23 (C2x) changesKeith Thompson
| +- Re: C23 (C2x) changesDavid Brown
| +* Re: C23 (C2x) changesThiago Adams
| |`- Re: C23 (C2x) changesThiago Adams
| `- Re: C23 (C2x) changesMehdi Amini
`* Re: C23 (C2x) changesTim Rentsch
 +* Re: C23 (C2x) changesThiago Adams
 |`* Re: C23 (C2x) changesTim Rentsch
 | `- Re: C23 (C2x) changesDavid Brown
 +* Re: C23 (C2x) changesGuillaume
 |+* Re: C23 (C2x) changesDavid Brown
 ||`* Re: C23 (C2x) changesGuillaume
 || `* Re: C23 (C2x) changesDavid Brown
 ||  `* Re: C23 (C2x) changesThiago Adams
 ||   `- Re: C23 (C2x) changesThiago Adams
 |`- Re: C23 (C2x) changesTim Rentsch
 `* Re: C23 (C2x) changesBonita Montero
  `* Re: C23 (C2x) changesJim Jackson

Pages:12345
Re: C23 (C2x) changes

<145dc56b-c3e8-4743-94d3-fb15d921272bn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18416&group=comp.lang.c#18416

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:f605:: with SMTP id y5mr1032647qkj.505.1632762952490;
Mon, 27 Sep 2021 10:15:52 -0700 (PDT)
X-Received: by 2002:ac8:1204:: with SMTP id x4mr1025973qti.410.1632762952187;
Mon, 27 Sep 2021 10:15:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 27 Sep 2021 10:15:51 -0700 (PDT)
In-Reply-To: <si99fr$ma4$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=189.6.249.78; posting-account=xFcAQAoAAAAoWlfpQ6Hz2n-MU9fthxbY
NNTP-Posting-Host: 189.6.249.78
References: <si99fr$ma4$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <145dc56b-c3e8-4743-94d3-fb15d921272bn@googlegroups.com>
Subject: Re: C23 (C2x) changes
From: thiago.a...@gmail.com (Thiago Adams)
Injection-Date: Mon, 27 Sep 2021 17:15:52 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Thiago Adams - Mon, 27 Sep 2021 17:15 UTC

On Monday, September 20, 2021 at 3:25:11 AM UTC-3, Mehdi Amini Valashani son of Bahram wrote:
> Hi,
>
> It seems these are some of changes for C23(C2x) standard taken from
> draft documents:
>
> https://en.cppreference.com/w/c/23
> https://thephd.dev/c-the-improvements-june-september-virtual-c-meeting
>
> What do you think of changes ?
>
> One minor suggestion for me is to have format specifier for bool type in
> printf function. Even though currently the fix is a trivial one.

Something new in C23 are attributes.
One of then is nodiscard :

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596.pdf

"
EXAMPLE 2
[[nodiscard]] int important_func(void);
void call(void) {
int i = important_func();
} No diagnostic for the call to important_func is encouraged despite the value of i not being used.
"
[[nodiscard("must check armed state")]]
bool arm_detonator(int);
void call(void) {
arm_detonator(3);
detonate();
}

"A diagnostic for the call toarm_detonator using the string literal "must check armed state" from the attribute argument
clause is encouraged."

This called my attention because the treatment is different for
int or _bool
I have no idea why.

And what is funny is that C++ has
[[noreturn]]
and C (before attributes and after)
_NoReturn.

Re: C23 (C2x) changes

<87fstpkhpj.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18418&group=comp.lang.c#18418

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Mon, 27 Sep 2021 11:15:52 -0700
Organization: None to speak of
Lines: 68
Message-ID: <87fstpkhpj.fsf@nosuchdomain.example.com>
References: <si99fr$ma4$1@dont-email.me>
<145dc56b-c3e8-4743-94d3-fb15d921272bn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="39ff22a84492e5ec37e25bfe4071ee27";
logging-data="14470"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/AT68Qn8GVXQhpixhsNKX5"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:6QDkwQDC3S1+nbccZ3ThxsohtVw=
sha1:8riirLi2gKZUnPGDT5fcCy0Snpk=
 by: Keith Thompson - Mon, 27 Sep 2021 18:15 UTC

Thiago Adams <thiago.adams@gmail.com> writes:
[...]
> Something new in C23 are attributes.
> One of then is nodiscard :
>
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596.pdf
>
> "
> EXAMPLE 2
> [[nodiscard]] int important_func(void);
> void call(void) {
> int i = important_func();
> }
> No diagnostic for the call to important_func is encouraged despite the value of i not being used.
> "
> [[nodiscard("must check armed state")]]
> bool arm_detonator(int);
> void call(void) {
> arm_detonator(3);
> detonate();
> }
>
> "A diagnostic for the call toarm_detonator using the string literal "must check armed state" from the attribute argument
> clause is encouraged."
>
> This called my attention because the treatment is different for
> int or _bool
> I have no idea why.

No, there's no difference in the treatment for int and _Bool.

The two relevant examples are:

[[nodiscard]] int important_func(void);
void call(void) {
int i = important_func();
}

No diagnostic for the call to important_func is encouraged despite
the value of i not being used.

and

[[nodiscard("must check armed state")]]
bool arm_detonator(int);
void call(void) {
arm_detonator(3);
detonate();
}

A diagnostic for the call to arm_detonator using the string literal
"must check armed state" from the attribute argument clause is
encouraged.

The difference isn't the types, it's the way the result is used. In the
first example, the result of the function is used to initialize an
object, so it's "used", even though that object's stored value is never
used. In the second example, the result isn't assigned to anything.
The point is that compilers aren't required to do data flow analysis;
any immediate use of the result is enough to turn off the warning. (Of
course compilers can warn about anything they like, and compilers
commonly do warn about unused variables, but that warning isn't
connected to the [[nodiscard]] attribute.)

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: C23 (C2x) changes

<sit8if$4ni$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18419&group=comp.lang.c#18419

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Mon, 27 Sep 2021 22:11:58 +0200
Organization: A noiseless patient Spider
Lines: 72
Message-ID: <sit8if$4ni$1@dont-email.me>
References: <si99fr$ma4$1@dont-email.me>
<145dc56b-c3e8-4743-94d3-fb15d921272bn@googlegroups.com>
<87fstpkhpj.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Sep 2021 20:11:59 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="e1fd99bcc021d5f6bbd9980aaacbe72d";
logging-data="4850"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TwBgjCK/K0qPXBbDAmwZ4G2IufXXIw60="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:cBO+vpIhNy4MtvbhGuH0EYYc1A8=
In-Reply-To: <87fstpkhpj.fsf@nosuchdomain.example.com>
Content-Language: en-GB
 by: David Brown - Mon, 27 Sep 2021 20:11 UTC

On 27/09/2021 20:15, Keith Thompson wrote:
> Thiago Adams <thiago.adams@gmail.com> writes:
> [...]
>> Something new in C23 are attributes.
>> One of then is nodiscard :
>>
>> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596.pdf
>>
>> "
>> EXAMPLE 2
>> [[nodiscard]] int important_func(void);
>> void call(void) {
>> int i = important_func();
>> }
>> No diagnostic for the call to important_func is encouraged despite the value of i not being used.
>> "
>> [[nodiscard("must check armed state")]]
>> bool arm_detonator(int);
>> void call(void) {
>> arm_detonator(3);
>> detonate();
>> }
>>
>> "A diagnostic for the call toarm_detonator using the string literal "must check armed state" from the attribute argument
>> clause is encouraged."
>>
>> This called my attention because the treatment is different for
>> int or _bool
>> I have no idea why.
>
> No, there's no difference in the treatment for int and _Bool.
>
> The two relevant examples are:
>
> [[nodiscard]] int important_func(void);
> void call(void) {
> int i = important_func();
> }
>
> No diagnostic for the call to important_func is encouraged despite
> the value of i not being used.
>
> and
>
> [[nodiscard("must check armed state")]]
> bool arm_detonator(int);
> void call(void) {
> arm_detonator(3);
> detonate();
> }
>
> A diagnostic for the call to arm_detonator using the string literal
> "must check armed state" from the attribute argument clause is
> encouraged.
>
> The difference isn't the types, it's the way the result is used. In the
> first example, the result of the function is used to initialize an
> object, so it's "used", even though that object's stored value is never
> used. In the second example, the result isn't assigned to anything.
> The point is that compilers aren't required to do data flow analysis;
> any immediate use of the result is enough to turn off the warning. (Of
> course compilers can warn about anything they like, and compilers
> commonly do warn about unused variables, but that warning isn't
> connected to the [[nodiscard]] attribute.)
>

Or, I think more accurately, it does not have to be connected to the
attribute. A compiler could choose to warn about "i" not being used in
the first example, precisely because of the attribute, even if it did
not normally warn about unused variables. There is quite a lot of
freedom about how the attributes are actually implemented.

Re: C23 (C2x) changes

<sitcfp$1fgs$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18420&group=comp.lang.c#18420

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!Puiiztk9lHEEQC0y3uUjRA.user.46.165.242.75.POSTED!not-for-mail
From: non...@add.invalid (Manfred)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Mon, 27 Sep 2021 23:18:48 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sitcfp$1fgs$1@gioia.aioe.org>
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me>
<sisn5m$ni6$1@gioia.aioe.org> <87y27it1mo.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="48668"; posting-host="Puiiztk9lHEEQC0y3uUjRA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Manfred - Mon, 27 Sep 2021 21:18 UTC

On 9/27/2021 6:38 PM, Ben Bacarisse wrote:
> Manfred <noname@add.invalid> writes:
>
>> On 9/20/2021 7:55 PM, Bart wrote:
>
>>> Of course it makes perfect sense to have a pile of 4294967295 apples,
>>> add another apple to the pile, and suddenly end up with 0 apples!
>>> Meanwhile, someone could remove that extra apple from the pile of
>>> -2147483648, to restore the original 2147483647, however that's too
>>> late: the overflow police have already been, and will do so again
>>> even when it becomes legal.
>>>
>>
>> It's all about modeling a problem domain.
>> In mathematics, /integer/ arithmetic (the one you use a.o. to add and
>> subtract things) is /signed/ (for any serious work, at least). The
>> tool that C offers to model this domain is signed integers - with the
>> unavoidable limitations of limited size.
>>
>> Unsigned integers are the tool that C offers for /binary/
>> arithmetic. In this context wrapping is one of the features that makes
>> them useful.
>
> Some mathematics concerns the natural numbers. Unsigned integer types
> would be an entirely natural (no pun intended) choice for these cases.
>

True, and in fact, while writing the post natural numbers came to mind
as well; for example, in a simple counter unsigned int makes perfect sense.

However, I was following up at Bart's post about what's the point of
adding an apple to a pile of 4294967295 apples and end up with nothing,
which is understandably disappointing, since stocking up that pile of
apples probably took a considerable amount of work...

A couple of considerations:
- How common is the need to model math that is strictly about natural
numbers compared to the need for integer math? (this is not a rhetorical
question, I'm genuinely curious).
It could also be argued that after all natural numbers can be handled
using signed integers, as long as in the transition from theoretical
analysis to practical analysis, the limitation of (2^31-1) is not that
different from the limitation of (2^32-1)

- more relevant, IMO: the main difference between signed and unsigned
types is that in the latter case all bits are digits, i.e. they
constitute a homogeneous set, which makes them specifically useful for
binary arithmetic (which justifies the difference in semantics, in my view).

Re: C23 (C2x) changes

<7a34aaec-a358-418b-b3ec-1eb56509ccf7n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18421&group=comp.lang.c#18421

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a0c:e381:: with SMTP id a1mr1857921qvl.42.1632777645190;
Mon, 27 Sep 2021 14:20:45 -0700 (PDT)
X-Received: by 2002:a05:622a:1993:: with SMTP id u19mr2129501qtc.168.1632777644946;
Mon, 27 Sep 2021 14:20:44 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 27 Sep 2021 14:20:44 -0700 (PDT)
In-Reply-To: <87fstpkhpj.fsf@nosuchdomain.example.com>
Injection-Info: google-groups.googlegroups.com; posting-host=189.6.249.78; posting-account=xFcAQAoAAAAoWlfpQ6Hz2n-MU9fthxbY
NNTP-Posting-Host: 189.6.249.78
References: <si99fr$ma4$1@dont-email.me> <145dc56b-c3e8-4743-94d3-fb15d921272bn@googlegroups.com>
<87fstpkhpj.fsf@nosuchdomain.example.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7a34aaec-a358-418b-b3ec-1eb56509ccf7n@googlegroups.com>
Subject: Re: C23 (C2x) changes
From: thiago.a...@gmail.com (Thiago Adams)
Injection-Date: Mon, 27 Sep 2021 21:20:45 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 71
 by: Thiago Adams - Mon, 27 Sep 2021 21:20 UTC

On Monday, September 27, 2021 at 3:16:07 PM UTC-3, Keith Thompson wrote:
> Thiago Adams <thiago...@gmail.com> writes:
> [...]
> > Something new in C23 are attributes.
> > One of then is nodiscard :
> >
> > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596.pdf
> >
> > "
> > EXAMPLE 2
> > [[nodiscard]] int important_func(void);
> > void call(void) {
> > int i = important_func();
> > }
> > No diagnostic for the call to important_func is encouraged despite the value of i not being used.
> > "
> > [[nodiscard("must check armed state")]]
> > bool arm_detonator(int);
> > void call(void) {
> > arm_detonator(3);
> > detonate();
> > }
> >
> > "A diagnostic for the call toarm_detonator using the string literal "must check armed state" from the attribute argument
> > clause is encouraged."
> >
> > This called my attention because the treatment is different for
> > int or _bool
> > I have no idea why.
> No, there's no difference in the treatment for int and _Bool.
>
> The two relevant examples are:
> [[nodiscard]] int important_func(void);
> void call(void) {
> int i = important_func();
> }
>
> No diagnostic for the call to important_func is encouraged despite
> the value of i not being used.
> and
> [[nodiscard("must check armed state")]]
> bool arm_detonator(int);
> void call(void) {
> arm_detonator(3);
> detonate();
> }
> A diagnostic for the call to arm_detonator using the string literal
> "must check armed state" from the attribute argument clause is
> encouraged.
> The difference isn't the types, it's the way the result is used. In the
> first example, the result of the function is used to initialize an
> object, so it's "used", even though that object's stored value is never
> used. In the second example, the result isn't assigned to anything.
> The point is that compilers aren't required to do data flow analysis;
> any immediate use of the result is enough to turn off the warning. (Of
> course compilers can warn about anything they like, and compilers
> commonly do warn about unused variables, but that warning isn't
> connected to the [[nodiscard]] attribute.)

hum.. right.
It is clear now thanks.

Although this can be ignored it looks a good documentation for the "function contract".

(The other topic about [static size] for arrays in that case I was expecting
more to be able to remove runtime checks and sizes.)

In this case it looks more like "nice to have" but not indispensable to change
the code style removing runtime checks for instance.

Re: C23 (C2x) changes

<8f03c4be-b71c-45ed-bd90-04d4d1c40e59n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18422&group=comp.lang.c#18422

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:9e4b:: with SMTP id h72mr2101387qke.475.1632778273158;
Mon, 27 Sep 2021 14:31:13 -0700 (PDT)
X-Received: by 2002:a0c:a89a:: with SMTP id x26mr2240450qva.35.1632778272986;
Mon, 27 Sep 2021 14:31:12 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 27 Sep 2021 14:31:12 -0700 (PDT)
In-Reply-To: <7a34aaec-a358-418b-b3ec-1eb56509ccf7n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=189.6.249.78; posting-account=xFcAQAoAAAAoWlfpQ6Hz2n-MU9fthxbY
NNTP-Posting-Host: 189.6.249.78
References: <si99fr$ma4$1@dont-email.me> <145dc56b-c3e8-4743-94d3-fb15d921272bn@googlegroups.com>
<87fstpkhpj.fsf@nosuchdomain.example.com> <7a34aaec-a358-418b-b3ec-1eb56509ccf7n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8f03c4be-b71c-45ed-bd90-04d4d1c40e59n@googlegroups.com>
Subject: Re: C23 (C2x) changes
From: thiago.a...@gmail.com (Thiago Adams)
Injection-Date: Mon, 27 Sep 2021 21:31:13 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 80
 by: Thiago Adams - Mon, 27 Sep 2021 21:31 UTC

On Monday, September 27, 2021 at 6:20:51 PM UTC-3, Thiago Adams wrote:
> On Monday, September 27, 2021 at 3:16:07 PM UTC-3, Keith Thompson wrote:
> > Thiago Adams <thiago...@gmail.com> writes:
> > [...]
> > > Something new in C23 are attributes.
> > > One of then is nodiscard :
> > >
> > > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596.pdf
> > >
> > > "
> > > EXAMPLE 2
> > > [[nodiscard]] int important_func(void);
> > > void call(void) {
> > > int i = important_func();
> > > }
> > > No diagnostic for the call to important_func is encouraged despite the value of i not being used.
> > > "
> > > [[nodiscard("must check armed state")]]
> > > bool arm_detonator(int);
> > > void call(void) {
> > > arm_detonator(3);
> > > detonate();
> > > }
> > >
> > > "A diagnostic for the call toarm_detonator using the string literal "must check armed state" from the attribute argument
> > > clause is encouraged."
> > >
> > > This called my attention because the treatment is different for
> > > int or _bool
> > > I have no idea why.
> > No, there's no difference in the treatment for int and _Bool.
> >
> > The two relevant examples are:
> > [[nodiscard]] int important_func(void);
> > void call(void) {
> > int i = important_func();
> > }
> >
> > No diagnostic for the call to important_func is encouraged despite
> > the value of i not being used.
> > and
> > [[nodiscard("must check armed state")]]
> > bool arm_detonator(int);
> > void call(void) {
> > arm_detonator(3);
> > detonate();
> > }
> > A diagnostic for the call to arm_detonator using the string literal
> > "must check armed state" from the attribute argument clause is
> > encouraged.
> > The difference isn't the types, it's the way the result is used. In the
> > first example, the result of the function is used to initialize an
> > object, so it's "used", even though that object's stored value is never
> > used. In the second example, the result isn't assigned to anything.
> > The point is that compilers aren't required to do data flow analysis;
> > any immediate use of the result is enough to turn off the warning. (Of
> > course compilers can warn about anything they like, and compilers
> > commonly do warn about unused variables, but that warning isn't
> > connected to the [[nodiscard]] attribute.)
> hum.. right.
> It is clear now thanks.
>
> Although this can be ignored it looks a good documentation for the "function contract".
>
> (The other topic about [static size] for arrays in that case I was expecting
> more to be able to remove runtime checks and sizes.)
>
> In this case it looks more like "nice to have" but not indispensable to change
> the code style removing runtime checks for instance.

Microsoft compiler has the macro _Check_return_
https://docs.microsoft.com/en-us/cpp/code-quality/annotating-function-behavior?view=msvc-160

Another point about attributes is that they are optional for code generation, (at least standard ones)

"166)Standard attributes specified by this document can be parsed but ignored by
an implementation without changing the semantics of a correct program; the same is not true
for attributes not specified by this document."

but we cannot use an old compilers because the parsing will fail. so.. the macros will remain
or the code will be changed gradually.

Re: C23 (C2x) changes

<siufaj$86h$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18423&group=comp.lang.c#18423

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: atorr...@gmail.com (Mehdi Amini)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Tue, 28 Sep 2021 10:43:21 +0330
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <siufaj$86h$1@dont-email.me>
References: <si99fr$ma4$1@dont-email.me>
<145dc56b-c3e8-4743-94d3-fb15d921272bn@googlegroups.com>
<87fstpkhpj.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 28 Sep 2021 07:13:23 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="42ea31caad74555708613b0c38fe4bec";
logging-data="8401"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ZPSTtj7Zyc6PNVsMucOvAJlsQwh03r78="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Cancel-Lock: sha1:wSwyVWpH4MZWboOZfpQoSTmyPXQ=
In-Reply-To: <87fstpkhpj.fsf@nosuchdomain.example.com>
Content-Language: en-US
 by: Mehdi Amini - Tue, 28 Sep 2021 07:13 UTC

On 9/27/21 9:45 PM, Keith Thompson wrote:
> Thiago Adams <thiago.adams@gmail.com> writes:
> [...]
[...]
> The difference isn't the types, it's the way the result is used. In the
> first example, the result of the function is used to initialize an
> object, so it's "used", even though that object's stored value is never
> used. In the second example, the result isn't assigned to anything.
> The point is that compilers aren't required to do data flow analysis;
> any immediate use of the result is enough to turn off the warning. (Of
> course compilers can warn about anything they like, and compilers
> commonly do warn about unused variables, but that warning isn't
> connected to the [[nodiscard]] attribute.)
>

Thank you for explanation. I also found this link for nodiscard
attribute:

https://en.cppreference.com/w/c/language/attributes/nodiscard

I have a question about attributes too. Coder may use attributes
directly or he/she may include a header file (<attributes.h> for
instance) ?

Re: Static bounds checking (was Re: C23 (C2x) changes)

<siusco$b2q$1@z-news.wcss.wroc.pl>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18424&group=comp.lang.c#18424

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!feeder.erje.net!newsfeed.pionier.net.pl!pwr.wroc.pl!news.wcss.wroc.pl!not-for-mail
From: antis...@math.uni.wroc.pl
Newsgroups: comp.lang.c
Subject: Re: Static bounds checking (was Re: C23 (C2x) changes)
Date: Tue, 28 Sep 2021 10:56:24 +0000 (UTC)
Organization: Politechnika Wroclawska
Lines: 25
Message-ID: <siusco$b2q$1@z-news.wcss.wroc.pl>
References: <si99fr$ma4$1@dont-email.me> <sovv1i-kui1.ln1@wilbur.25thandClement.com> <ptf3J.44292$ol1.39305@fx42.iad> <sikth7$vpc$1@dont-email.me> <8xu3J.74157$QzOf.42137@fx17.iad> <simcvk$r2n$1@solani.org>
NNTP-Posting-Host: hera.math.uni.wroc.pl
X-Trace: z-news.wcss.wroc.pl 1632826584 11354 156.17.86.1 (28 Sep 2021 10:56:24 GMT)
X-Complaints-To: abuse@news.pwr.wroc.pl
NNTP-Posting-Date: Tue, 28 Sep 2021 10:56:24 +0000 (UTC)
Cancel-Lock: sha1:Abo3pkYL3aTi07hke4YmkmJenQk=
User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-10-amd64 (x86_64))
 by: antis...@math.uni.wroc.pl - Tue, 28 Sep 2021 10:56 UTC

Philipp Klaus Krause <pkk@spth.de> wrote:
> Am 25.09.21 um 03:00 schrieb Branimir Maksimovic:
> > Look, bounds checking is costly, if done in run time, [?]
>
> Yes. But unlike Annex K, which is about runtime bounds checking, the
> features now discussed for C23 are about improving static bounds
> checking, i.e. compile-time bounds checking. Via array types, including
> VLA types, as function parameters. This could allow both improved
> diagnostics and optimization in the callee.
>
> AFAIR the main problem is that the syntax already has a meaning (an
> array currently just decays to a pointer). But maybe actual use is
> uncommen enough that it can still be changed.

I did not see current proposal in the standard. However, in the past
I have seen proposal for bounds checking in C. The whole idea was
that syntax should be acceptable to existing compiler and as long
as accesses are in bounds existing compiler should generate
correct code. Such proposals may break existing code, however
probably no more than type based alias analysis. And given
compile-time nature of checking conseqences of breakage should
be quite managable.

--
Waldek Hebisch

Re: C23 (C2x) changes

<siv6p1$si5$1@z-news.wcss.wroc.pl>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18425&group=comp.lang.c#18425

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!newsfeed.pionier.net.pl!pwr.wroc.pl!news.wcss.wroc.pl!not-for-mail
From: antis...@math.uni.wroc.pl
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Tue, 28 Sep 2021 13:53:37 +0000 (UTC)
Organization: Politechnika Wroclawska
Lines: 68
Message-ID: <siv6p1$si5$1@z-news.wcss.wroc.pl>
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me> <siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me> <sisn5m$ni6$1@gioia.aioe.org> <87y27it1mo.fsf@bsb.me.uk> <sitcfp$1fgs$1@gioia.aioe.org>
NNTP-Posting-Host: hera.math.uni.wroc.pl
X-Trace: z-news.wcss.wroc.pl 1632837217 29253 156.17.86.1 (28 Sep 2021 13:53:37 GMT)
X-Complaints-To: abuse@news.pwr.wroc.pl
NNTP-Posting-Date: Tue, 28 Sep 2021 13:53:37 +0000 (UTC)
Cancel-Lock: sha1:kLBrxse9CEAo6RuV+JEKKBToT8Q=
User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-10-amd64 (x86_64))
X-Received-Bytes: 4300
 by: antis...@math.uni.wroc.pl - Tue, 28 Sep 2021 13:53 UTC

Manfred <noname@add.invalid> wrote:
> On 9/27/2021 6:38 PM, Ben Bacarisse wrote:
> > Manfred <noname@add.invalid> writes:
> >
> >> On 9/20/2021 7:55 PM, Bart wrote:
> >
> >>> Of course it makes perfect sense to have a pile of 4294967295 apples,
> >>> add another apple to the pile, and suddenly end up with 0 apples!
> >>> Meanwhile, someone could remove that extra apple from the pile of
> >>> -2147483648, to restore the original 2147483647, however that's too
> >>> late: the overflow police have already been, and will do so again
> >>> even when it becomes legal.
> >>>
> >>
> >> It's all about modeling a problem domain.
> >> In mathematics, /integer/ arithmetic (the one you use a.o. to add and
> >> subtract things) is /signed/ (for any serious work, at least). The
> >> tool that C offers to model this domain is signed integers - with the
> >> unavoidable limitations of limited size.
> >>
> >> Unsigned integers are the tool that C offers for /binary/
> >> arithmetic. In this context wrapping is one of the features that makes
> >> them useful.
> >
> > Some mathematics concerns the natural numbers. Unsigned integer types
> > would be an entirely natural (no pun intended) choice for these cases.
> >
>
> True, and in fact, while writing the post natural numbers came to mind
> as well; for example, in a simple counter unsigned int makes perfect sense.
>
> However, I was following up at Bart's post about what's the point of
> adding an apple to a pile of 4294967295 apples and end up with nothing,
> which is understandably disappointing, since stocking up that pile of
> apples probably took a considerable amount of work...
>
> A couple of considerations:
> - How common is the need to model math that is strictly about natural
> numbers compared to the need for integer math? (this is not a rhetorical
> question, I'm genuinely curious).

AFAICS typically in theoretical setting one considers integers
with possibly added assertion that they are nonnegative. But
there may be also assertion that numbers are bigger than 0,
or bigger than 1. And there are other popular assertions.
So IMHO need to specifically model nonnegative integers is
limited.

> It could also be argued that after all natural numbers can be handled
> using signed integers, as long as in the transition from theoretical
> analysis to practical analysis, the limitation of (2^31-1) is not that
> different from the limitation of (2^32-1)
>
> - more relevant, IMO: the main difference between signed and unsigned
> types is that in the latter case all bits are digits, i.e. they
> constitute a homogeneous set, which makes them specifically useful for
> binary arithmetic (which justifies the difference in semantics, in my view).

Actually, signed numbers works very well in base 3 (or other odd
bases). Difference compared to unsigned is that for signed numbers
it is natural to use signed digits. Signed digits means that
re-interpering string of digits as unsigend number changes value
in less regular way, so in new C3 (ternary C) language one
would have to decide if cast work by re-interpeting digist or
tries to preseve value.

--
Waldek Hebisch

Re: C23 (C2x) changes

<ucR4J.59817$jm6.22760@fx07.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18431&group=comp.lang.c#18431

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx07.iad.POSTED!not-for-mail
Newsgroups: comp.lang.c
From: branimir...@gmail.com (Branimir Maksimovic)
Subject: Re: C23 (C2x) changes
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me>
<sisn5m$ni6$1@gioia.aioe.org>
User-Agent: slrn/1.0.3 (Darwin)
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Lines: 46
Message-ID: <ucR4J.59817$jm6.22760@fx07.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Wed, 29 Sep 2021 03:38:02 UTC
Organization: usenet-news.net
Date: Wed, 29 Sep 2021 03:38:02 GMT
X-Received-Bytes: 2706
 by: Branimir Maksimovic - Wed, 29 Sep 2021 03:38 UTC

On 2021-09-27, Manfred <noname@add.invalid> wrote:
> On 9/20/2021 7:55 PM, Bart wrote:
>> On 20/09/2021 17:17, David Brown wrote:
>>> On 20/09/2021 17:41, John Bode wrote:
>>
>>>> If signed integer representations other than two's complement will
>>>> no longer be supported, does this mean signed integer overflow can
>>>> have a well-defined behavior?  Or will it still be left undefined
>>>> to allow for optimizations?  Or could that be controlled with one
>>>> of these newfangled attribute thingies?
>>>
>>>
>>> No, signed integer overflow is still undefined behaviour - for which I
>>> am very glad.  Defining it is terrible, IMHO, since any definition you
>>> give will be the wrong answer.  Some would want it defined as wrapping
>>> ($DEITY knows why, since it is the silliest of all definitions despite
>>> being fairly efficient to implement), some would want it as an error or
>>> a trap, some would want saturation, some would want a NaN, some would
>>> want errno to be set.
>>>
>>> For those that think it makes sense to have a pile of 2147483647 apples,
>>> add another apple to the pile, and end up with -2147483648 apples, gcc
>>> still has the "-fwrapv" option.
>>
>> Of course it makes perfect sense to have a pile of 4294967295 apples,
>> add another apple to the pile, and suddenly end up with 0 apples!
>>
>> Meanwhile, someone could remove that extra apple from the pile of
>> -2147483648, to restore the original 2147483647, however that's too
>> late: the overflow police have already been, and will do so again even
>> when it becomes legal.
>>
>
> It's all about modeling a problem domain.
> In mathematics, /integer/ arithmetic (the one you use a.o. to add and
> subtract things) is /signed/ (for any serious work, at least).

Not true. That depends on Algebra you define, and is ok to define
operators only on positive set.

--

7-77-777
Evil Sinner!

Re: C23 (C2x) changes

<86pmsnsea4.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18504&group=comp.lang.c#18504

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Sat, 02 Oct 2021 07:16:19 -0700
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <86pmsnsea4.fsf@linuxsc.com>
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me> <siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me> <siao15$qbr$1@dont-email.me> <sib0ie$uve$1@dont-email.me> <%b82J.66798$VZ1.3585@fx08.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="394007ef4ff0447a8819fcdafe9c3245";
logging-data="4433"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OLV3q2SRtnLEFyPI2VpRC0xLDQE0WaHM="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:mS+uxaqibMRavhIcfLkC8mF+X88=
sha1:0ClHR8eXW/FOE7QMNHh2TZ/STDA=
 by: Tim Rentsch - Sat, 2 Oct 2021 14:16 UTC

scott@slp53.sl.home (Scott Lurndal) writes:

> Bart <bc@freeuk.com> writes:
>
>> [...]
>>
>> Try this program, where the number of applies is represented with
>> an 8-bit value:
>>
>> int8_t apples;
>>
>> apples = 127;
>> printf("Initial pile of apples: %d\n",apples);
>
> if (apples < CHAR_MAX) {
>
>> apples += 1;
>
> } else {
> panic("Logic error by the unqualified C programmer\n");
> }
>
> fixed it for you.

if (apples < SCHAR_MAX) {

Re: C23 (C2x) changes

<86lf3bsbwz.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18506&group=comp.lang.c#18506

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Sat, 02 Oct 2021 08:07:24 -0700
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <86lf3bsbwz.fsf@linuxsc.com>
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me> <siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me> <sisn5m$ni6$1@gioia.aioe.org> <87y27it1mo.fsf@bsb.me.uk> <sitcfp$1fgs$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="394007ef4ff0447a8819fcdafe9c3245";
logging-data="620"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hNTfTnLcjEZF/3eMDbppOD/U60XP+1yQ="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:kC2ON2tQKmFeNx9nXRBWUJmBxwo=
sha1:KWjbfC3RC64n7TkHdu+ghMu+GOA=
 by: Tim Rentsch - Sat, 2 Oct 2021 15:07 UTC

Manfred <noname@add.invalid> writes:

> [...]

> - How common is the need to model math that is strictly about
> natural numbers compared to the need for integer math? (this is
> not a rhetorical question, I'm genuinely curious).

Combinatorics and number theory routinely concern themselves with
domains limited to the non-negative integers. The celebrated
prime number theorem, for example, counts primes less than a
given upper bound, but considers only non-negative numbers as
primes. Is -3 a prime? In a sense yes, but it's easier just to
avoid the question by admitting only non-negative integers as
candidates.

> It could also be argued that after all natural numbers can be
> handled using signed integers, as long as in the transition from
> theoretical analysis to practical analysis, the limitation of
> (2^31-1) is not that different from the limitation of (2^32-1)

Considering practical aspects of writing code, if the domain of
interest is confined to non-negative values, using an unsigned
type (for function parameters, etc) makes for an easier fit, as
otherwise input values would have to be tested for being negative,
and something done to handle the offending situation. If unsigned
types are used the problem doesn't come up.

Also, when working in code related to those theoretical domains,
I can say from first hand experience that we _always_ want that
last bit, no matter how wide the data type in question. An extra
bit means a larger range of applicability, and that's always
useful.

> - more relevant, IMO: the main difference between signed and
> unsigned types is that in the latter case all bits are digits,
> i.e. they constitute a homogeneous set, which makes them
> specifically useful for binary arithmetic (which justifies the
> difference in semantics, in my view).

Speaking for myself a more important difference is that signed
types have various pesky undefined and implementation-defined
behaviors, whereas unsigned types do not. In most cases it's
easier to reason about code that uses unsigned types if the range
of possible values is even remotely close to the limits of the
type in question. I routinely use unsigned types for variables
unless the variable in question must be able to hold a negative
value.

Re: C23 (C2x) changes

<LI_5J.44592$rsCb.15433@fx01.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18507&group=comp.lang.c#18507

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx01.iad.POSTED!not-for-mail
Newsgroups: comp.lang.c
From: branimir...@icloud.com (Branimir Maksimovic)
Subject: Re: C23 (C2x) changes
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me>
<siao15$qbr$1@dont-email.me> <sib0ie$uve$1@dont-email.me>
<%b82J.66798$VZ1.3585@fx08.iad> <86pmsnsea4.fsf@linuxsc.com>
User-Agent: slrn/1.0.3 (Darwin)
Lines: 35
Message-ID: <LI_5J.44592$rsCb.15433@fx01.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Sat, 02 Oct 2021 15:15:55 UTC
Organization: usenet-news.net
Date: Sat, 02 Oct 2021 15:15:55 GMT
X-Received-Bytes: 1551
 by: Branimir Maksimovic - Sat, 2 Oct 2021 15:15 UTC

On 2021-10-02, Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
> scott@slp53.sl.home (Scott Lurndal) writes:
>
>> Bart <bc@freeuk.com> writes:
>>
>>> [...]
>>>
>>> Try this program, where the number of applies is represented with
>>> an 8-bit value:
>>>
>>> int8_t apples;
>>>
>>> apples = 127;
>>> printf("Initial pile of apples: %d\n",apples);
>>
>> if (apples < CHAR_MAX) {
>>
>>> apples += 1;
>>
>> } else {
>> panic("Logic error by the unqualified C programmer\n");
>> }
>>
>> fixed it for you.
>
> if (apples < SCHAR_MAX) {
>
if (apples < sizeof(char)*CHAR_MAX) /** :P */

--

7-77-777
Evil Sinner!
to weak you should be meek, and you should brainfuck stronger
https://github.com/rofl0r/chaos-pp

Re: C23 (C2x) changes

<0L_5J.44593$rsCb.5791@fx01.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18508&group=comp.lang.c#18508

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!aioe.org!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx01.iad.POSTED!not-for-mail
Newsgroups: comp.lang.c
From: branimir...@icloud.com (Branimir Maksimovic)
Subject: Re: C23 (C2x) changes
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me>
<sisn5m$ni6$1@gioia.aioe.org> <87y27it1mo.fsf@bsb.me.uk>
<sitcfp$1fgs$1@gioia.aioe.org> <86lf3bsbwz.fsf@linuxsc.com>
User-Agent: slrn/1.0.3 (Darwin)
Lines: 27
Message-ID: <0L_5J.44593$rsCb.5791@fx01.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Sat, 02 Oct 2021 15:18:20 UTC
Organization: usenet-news.net
Date: Sat, 02 Oct 2021 15:18:20 GMT
X-Received-Bytes: 1576
 by: Branimir Maksimovic - Sat, 2 Oct 2021 15:18 UTC

On 2021-10-02, Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
> Manfred <noname@add.invalid> writes:
>
>> [...]
>
>> - How common is the need to model math that is strictly about
>> natural numbers compared to the need for integer math? (this is
>> not a rhetorical question, I'm genuinely curious).
>
> Combinatorics and number theory routinely concern themselves with
> domains limited to the non-negative integers. The celebrated
> prime number theorem, for example, counts primes less than a
> given upper bound, but considers only non-negative numbers as
> primes. Is -3 a prime?

Please take a look at this video carefully:
https://youtu.be/094y1Z2wpJg

--

7-77-777
Evil Sinner!
to weak you should be meek, and you should brainfuck stronger
https://github.com/rofl0r/chaos-pp

Re: C23 (C2x) changes

<86h7dzs9od.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18509&group=comp.lang.c#18509

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Sat, 02 Oct 2021 08:55:46 -0700
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <86h7dzs9od.fsf@linuxsc.com>
References: <si99fr$ma4$1@dont-email.me> <r6tq1i-kkp.ln1@wilbur.25thandClement.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="394007ef4ff0447a8819fcdafe9c3245";
logging-data="22007"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+v+WQ3Awl05Cbs9Y/koafYFiUsq++/04A="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:9iEyjdy0vlTGyOFkFV2cWQrJcH8=
sha1:BujMxY9s2aG5ZMTGKgzOnXKyWZk=
 by: Tim Rentsch - Sat, 2 Oct 2021 15:55 UTC

William Ahern <william@25thandClement.com> writes:

> [...]
> IME [a very important pre-processor capability] is the ability to
> use the defined operator in macros.

I share your sense that this would be a useful capability, including
the lazy evaluation aspect. However there are (or at least may be)
subtle interactions that need to be worked out. For example,

#define foo(x) INT_MIN < -INT_MAX || defined x

or

#define bas(x) defined x##_a || defined x##_b

would very likely need new wording in how macro expansion works so
that these and other unusual cases would be unambiguously defined.
Not necessarily an easy job.

Bottom line, if you think some capability in this direction is
important to add to the C standard, write a proposal that covers
what changes are needed, including all the oddball and corner cases,
and submit it to the ISO C committee. These things don't happen
unless they have a champion who has gone through much of the
preliminary effort to get them incorporated into the C standard.

Re: C23 (C2x) changes

<5U%5J.22510$d82.21245@fx21.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18510&group=comp.lang.c#18510

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!aioe.org!news.uzoreto.com!peer03.ams4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx21.iad.POSTED!not-for-mail
Newsgroups: comp.lang.c
From: branimir...@icloud.com (Branimir Maksimovic)
Subject: Re: C23 (C2x) changes
References: <si99fr$ma4$1@dont-email.me>
<r6tq1i-kkp.ln1@wilbur.25thandClement.com> <86h7dzs9od.fsf@linuxsc.com>
User-Agent: slrn/1.0.3 (Darwin)
Lines: 31
Message-ID: <5U%5J.22510$d82.21245@fx21.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Sat, 02 Oct 2021 16:36:17 UTC
Organization: usenet-news.net
Date: Sat, 02 Oct 2021 16:36:17 GMT
X-Received-Bytes: 1430
 by: Branimir Maksimovic - Sat, 2 Oct 2021 16:36 UTC

On 2021-10-02, Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
> William Ahern <william@25thandClement.com> writes:
>
>> [...]
>> IME [a very important pre-processor capability] is the ability to
>> use the defined operator in macros.
>
> I share your sense that this would be a useful capability, including
> the lazy evaluation aspect. However there are (or at least may be)
> subtle interactions that need to be worked out. For example,
>
> #define foo(x) INT_MIN < -INT_MAX || defined x
>
what's wrong with:
#define x 5
#include <limits.h>
#if defined(x)
#define foo(x) INT_MIN < -INT_MAX
#endif
#include <stdio.h>
int main(void) {
if(foo(FIVE))printf("%d\n",foo(3));
}

--

7-77-777
Evil Sinner!
to weak you should be meek, and you should brainfuck stronger

Re: C23 (C2x) changes

<87h7dzgk1k.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18515&group=comp.lang.c#18515

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Sat, 02 Oct 2021 15:04:55 -0700
Organization: None to speak of
Lines: 27
Message-ID: <87h7dzgk1k.fsf@nosuchdomain.example.com>
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me>
<sisn5m$ni6$1@gioia.aioe.org> <87y27it1mo.fsf@bsb.me.uk>
<sitcfp$1fgs$1@gioia.aioe.org> <86lf3bsbwz.fsf@linuxsc.com>
<0L_5J.44593$rsCb.5791@fx01.iad>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="c2d6cdc050f73b1d409dee830d1f9cb0";
logging-data="14124"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19d97A/vCUusdiIqYTh2Ig9"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:NhSBj7zPGEljropv1IeizvnyRIk=
sha1:3WJsTQocZO5pO/JoGQ8Mpv4dExg=
 by: Keith Thompson - Sat, 2 Oct 2021 22:04 UTC

Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
> On 2021-10-02, Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
>> Manfred <noname@add.invalid> writes:
>>
>>> [...]
>>
>>> - How common is the need to model math that is strictly about
>>> natural numbers compared to the need for integer math? (this is
>>> not a rhetorical question, I'm genuinely curious).
>>
>> Combinatorics and number theory routinely concern themselves with
>> domains limited to the non-negative integers. The celebrated
>> prime number theorem, for example, counts primes less than a
>> given upper bound, but considers only non-negative numbers as
>> primes. Is -3 a prime?
>
> Please take a look at this video carefully:
> https://youtu.be/094y1Z2wpJg

Why?

(It's about the Collatz Conjecture, and it's more than 20 minutes long.)

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: C23 (C2x) changes

<z786J.143438$rl3.15795@fx45.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18522&group=comp.lang.c#18522

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!news.neodome.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer03.ams4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx45.iad.POSTED!not-for-mail
Newsgroups: comp.lang.c
From: branimir...@icloud.com (Branimir Maksimovic)
Subject: Re: C23 (C2x) changes
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me>
<sisn5m$ni6$1@gioia.aioe.org> <87y27it1mo.fsf@bsb.me.uk>
<sitcfp$1fgs$1@gioia.aioe.org> <86lf3bsbwz.fsf@linuxsc.com>
<0L_5J.44593$rsCb.5791@fx01.iad> <87h7dzgk1k.fsf@nosuchdomain.example.com>
User-Agent: slrn/1.0.3 (Darwin)
Lines: 33
Message-ID: <z786J.143438$rl3.15795@fx45.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Sun, 03 Oct 2021 01:58:55 UTC
Organization: usenet-news.net
Date: Sun, 03 Oct 2021 01:58:55 GMT
X-Received-Bytes: 1981
 by: Branimir Maksimovic - Sun, 3 Oct 2021 01:58 UTC

On 2021-10-02, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
>> On 2021-10-02, Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
>>> Manfred <noname@add.invalid> writes:
>>>
>>>> [...]
>>>
>>>> - How common is the need to model math that is strictly about
>>>> natural numbers compared to the need for integer math? (this is
>>>> not a rhetorical question, I'm genuinely curious).
>>>
>>> Combinatorics and number theory routinely concern themselves with
>>> domains limited to the non-negative integers. The celebrated
>>> prime number theorem, for example, counts primes less than a
>>> given upper bound, but considers only non-negative numbers as
>>> primes. Is -3 a prime?
>>
>> Please take a look at this video carefully:
>> https://youtu.be/094y1Z2wpJg
>
> Why?
>
> (It's about the Collatz Conjecture, and it's more than 20 minutes long.)
>
So do you have *explanation*?
Why do you ask about negative primes?

--

7-77-777
Evil Sinner!
to weak you should be meek, and you should brainfuck stronger
https://github.com/rofl0r/chaos-pp

Re: C23 (C2x) changes

<87czomhf47.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18525&group=comp.lang.c#18525

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Sat, 02 Oct 2021 22:06:00 -0700
Organization: None to speak of
Lines: 26
Message-ID: <87czomhf47.fsf@nosuchdomain.example.com>
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me>
<sisn5m$ni6$1@gioia.aioe.org> <87y27it1mo.fsf@bsb.me.uk>
<sitcfp$1fgs$1@gioia.aioe.org> <86lf3bsbwz.fsf@linuxsc.com>
<0L_5J.44593$rsCb.5791@fx01.iad>
<87h7dzgk1k.fsf@nosuchdomain.example.com>
<z786J.143438$rl3.15795@fx45.iad>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="c2d6cdc050f73b1d409dee830d1f9cb0";
logging-data="25781"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194on4A4AknF92pO33q/ENc"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:JzveVnCC6ctOZNq4nMiQb1rSCIM=
sha1:K7yMZIGwUPBAdK7Y9OhCr9eL5r4=
 by: Keith Thompson - Sun, 3 Oct 2021 05:06 UTC

Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
> On 2021-10-02, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
[...]
>>> Please take a look at this video carefully:
>>> https://youtu.be/094y1Z2wpJg
>>
>> Why?
>>
>> (It's about the Collatz Conjecture, and it's more than 20 minutes long.)
>>
> So do you have *explanation*?

For what?

> Why do you ask about negative primes?

I didn't.

Is there anything in the video that's relevant either to this newsgroup
or to this thread? If so, what?

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: C23 (C2x) changes

<87h7dytuxc.fsf@mid.deneb.enyo.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18526&group=comp.lang.c#18526

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.enyo.de!.POSTED!not-for-mail
From: fw...@deneb.enyo.de (Florian Weimer)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Sun, 03 Oct 2021 09:43:43 +0200
Message-ID: <87h7dytuxc.fsf@mid.deneb.enyo.de>
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: news.enyo.de;
logging-data="18667"; mail-complaints-to="news@enyo.de"
Cancel-Lock: sha1:lr/ln30fq8rfSb2SePleDNwonVQ=
 by: Florian Weimer - Sun, 3 Oct 2021 07:43 UTC

* John Bode:

> it could simply just not name them:
>
> void bletch( int *, char *, double f )
> {
> // do something with f
> }
>
> and avoid that altogether.
>
> Shitcanning old-style function definitions is long overdue - yes, I'm
> sure this will break a non-trivial amount of legacy code, but dammit,
> a lot of that code *needs* to be broken so it can be properly updated.

The change is supposed to be compatible with both old-style function
definitions and implicit ints. There could be a syntactic ambiguity,
but in this context, at least GCC today treats an identifier that has
a type of the same name in scope as a type, not as a parameter name
(which could either be int implicitly, or assigned a different type
later). So no currently accepted programs should change meaning.

I'm not saying that implicit ints (or implicit function declarations)
or old-style function definitions are a good thing. But there isn't
much of a compatibility concern here, I think.

Re: C23 (C2x) changes

<LPf6J.62135$6U3.7179@fx43.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18527&group=comp.lang.c#18527

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!news.neodome.net!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx43.iad.POSTED!not-for-mail
Newsgroups: comp.lang.c
From: branimir...@icloud.com (Branimir Maksimovic)
Subject: Re: C23 (C2x) changes
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me>
<sisn5m$ni6$1@gioia.aioe.org> <87y27it1mo.fsf@bsb.me.uk>
<sitcfp$1fgs$1@gioia.aioe.org> <86lf3bsbwz.fsf@linuxsc.com>
<0L_5J.44593$rsCb.5791@fx01.iad> <87h7dzgk1k.fsf@nosuchdomain.example.com>
<z786J.143438$rl3.15795@fx45.iad> <87czomhf47.fsf@nosuchdomain.example.com>
User-Agent: slrn/1.0.3 (Darwin)
Lines: 32
Message-ID: <LPf6J.62135$6U3.7179@fx43.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Sun, 03 Oct 2021 10:43:55 UTC
Organization: usenet-news.net
Date: Sun, 03 Oct 2021 10:43:55 GMT
X-Received-Bytes: 1836
 by: Branimir Maksimovic - Sun, 3 Oct 2021 10:43 UTC

On 2021-10-03, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
>> On 2021-10-02, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>> Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
> [...]
>>>> Please take a look at this video carefully:
>>>> https://youtu.be/094y1Z2wpJg
>>>
>>> Why?
>>>
>>> (It's about the Collatz Conjecture, and it's more than 20 minutes long.)
>>>
>> So do you have *explanation*?
>
> For what?
>
>> Why do you ask about negative primes?
>
> I didn't.
>
> Is there anything in the video that's relevant either to this newsgroup
> or to this thread? If so, what?
>
Sorry, that was Ttim Rensch i replied, you just replied
on something wasn't you asked for :P

--

7-77-777
Evil Sinner!
to weak you should be meek, and you should brainfuck stronger
https://github.com/rofl0r/chaos-pp

Re: C23 (C2x) changes

<sjcn6j$5ec$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18531&group=comp.lang.c#18531

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!aioe.org!PEYapGefI5ARqVZFhFUmuA.user.46.165.242.75.POSTED!not-for-mail
From: mess...@bottle.org (Guillaume)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Sun, 3 Oct 2021 18:53:33 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sjcn6j$5ec$1@gioia.aioe.org>
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<87h7dytuxc.fsf@mid.deneb.enyo.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="5580"; posting-host="PEYapGefI5ARqVZFhFUmuA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Content-Language: fr
X-Notice: Filtered by postfilter v. 0.9.2
 by: Guillaume - Sun, 3 Oct 2021 16:53 UTC

Le 03/10/2021 à 09:43, Florian Weimer a écrit :
> * John Bode:
>
>> it could simply just not name them:
>>
>> void bletch( int *, char *, double f )
>> {
>> // do something with f
>> }
>>
>> and avoid that altogether.
>>
>> Shitcanning old-style function definitions is long overdue - yes, I'm
>> sure this will break a non-trivial amount of legacy code, but dammit,
>> a lot of that code *needs* to be broken so it can be properly updated.
>
> The change is supposed to be compatible with both old-style function
> definitions and implicit ints. There could be a syntactic ambiguity,
> but in this context, at least GCC today treats an identifier that has
> a type of the same name in scope as a type, not as a parameter name
> (which could either be int implicitly, or assigned a different type
> later). So no currently accepted programs should change meaning.
>
> I'm not saying that implicit ints (or implicit function declarations)
> or old-style function definitions are a good thing. But there isn't
> much of a compatibility concern here, I think.

And anyway... speaking of GCC, it still supports C89 using the -std
option, so breaking old code is not really an issue. GCC might not keep
support for very old standard revisions forever, but by the time C23 is
the minimal revision supported, you'll have had ample time to migrate.
Probably same thing with most other C compilers out there.

Just because there is a new revision of the standard out doesn't mean
you *have* to comply with it. Nothing wrong with sticking to older
revisions if a given code base requires it. Sure at some point, very old
revisions will probably stop being supported, but I doubt it's going to
happen anytime soon. Just a thought.

Re: C23 (C2x) changes

<878rz9hmvg.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18536&group=comp.lang.c#18536

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Sun, 03 Oct 2021 13:30:43 -0700
Organization: None to speak of
Lines: 34
Message-ID: <878rz9hmvg.fsf@nosuchdomain.example.com>
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me>
<sisn5m$ni6$1@gioia.aioe.org> <87y27it1mo.fsf@bsb.me.uk>
<sitcfp$1fgs$1@gioia.aioe.org> <86lf3bsbwz.fsf@linuxsc.com>
<0L_5J.44593$rsCb.5791@fx01.iad>
<87h7dzgk1k.fsf@nosuchdomain.example.com>
<z786J.143438$rl3.15795@fx45.iad>
<87czomhf47.fsf@nosuchdomain.example.com>
<LPf6J.62135$6U3.7179@fx43.iad>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="c2d6cdc050f73b1d409dee830d1f9cb0";
logging-data="26197"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18F0i2DifaQ66l+9khqKc0C"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:Mlm88pS4lwKvungy6N66SGCUDhI=
sha1:v24voUdlwRksdZzjwuZNN3NX4+c=
 by: Keith Thompson - Sun, 3 Oct 2021 20:30 UTC

Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
> On 2021-10-03, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
>>> On 2021-10-02, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>> Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
>> [...]
>>>>> Please take a look at this video carefully:
>>>>> https://youtu.be/094y1Z2wpJg
>>>>
>>>> Why?
>>>>
>>>> (It's about the Collatz Conjecture, and it's more than 20 minutes long.)
>>>>
>>> So do you have *explanation*?
>>
>> For what?
>>
>>> Why do you ask about negative primes?
>>
>> I didn't.
>>
>> Is there anything in the video that's relevant either to this newsgroup
>> or to this thread? If so, what?
>>
> Sorry, that was Ttim Rensch i replied, you just replied
> on something wasn't you asked for :P

So you posted a link to a 20-minute video with no explanation, and
you're still unwilling to explain how or whether it's relevant.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: C23 (C2x) changes

<874k9xhlq1.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18537&group=comp.lang.c#18537

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C23 (C2x) changes
Date: Sun, 03 Oct 2021 13:55:34 -0700
Organization: None to speak of
Lines: 54
Message-ID: <874k9xhlq1.fsf@nosuchdomain.example.com>
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<87h7dytuxc.fsf@mid.deneb.enyo.de>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="c2d6cdc050f73b1d409dee830d1f9cb0";
logging-data="6399"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181oUHkzGtlztk3eOPL11MW"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:bX56uUt3hA7JjLHhns5gXYd0t8Y=
sha1:UVVjeP7enQMuRYrfRcHbH70aEDc=
 by: Keith Thompson - Sun, 3 Oct 2021 20:55 UTC

Florian Weimer <fw@deneb.enyo.de> writes:
> * John Bode:
>
>> it could simply just not name them:
>>
>> void bletch( int *, char *, double f )
>> {
>> // do something with f
>> }
>>
>> and avoid that altogether.
>>
>> Shitcanning old-style function definitions is long overdue - yes, I'm
>> sure this will break a non-trivial amount of legacy code, but dammit,
>> a lot of that code *needs* to be broken so it can be properly updated.
>
> The change is supposed to be compatible with both old-style function
> definitions and implicit ints. There could be a syntactic ambiguity,
> but in this context, at least GCC today treats an identifier that has
> a type of the same name in scope as a type, not as a parameter name
> (which could either be int implicitly, or assigned a different type
> later). So no currently accepted programs should change meaning.

Implicit int has not existed in the C language since the 1999 standard,
and all code that depends on it has been invalid since then.

Treating a possibly ambiguous identifier as a type name isn't specific
to GCC. It's a language rule. See N1570 6.7.6.3p11.

The N2596 draft of C23 is not compatible with old-style function
definitions. It does retain old-style function *declarations* (and
marks them as obsolescent).

This:

int main(argc, argv)
int argc;
char *argv[];
{
}

is valid in all versions of C up to and including C17, but is invalid in
the proposed C23.

> I'm not saying that implicit ints (or implicit function declarations)
> or old-style function definitions are a good thing. But there isn't
> much of a compatibility concern here, I think.

There is.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: C23 (C2x) changes

<TXv6J.38722$GD7.8414@fx23.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18540&group=comp.lang.c#18540

  copy link   Newsgroups: comp.lang.c
Path: rocksolid2!news.neodome.net!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx23.iad.POSTED!not-for-mail
Newsgroups: comp.lang.c
From: branimir...@icloud.com (Branimir Maksimovic)
Subject: Re: C23 (C2x) changes
References: <si99fr$ma4$1@dont-email.me> <siaa3b$t76$1@dont-email.me>
<siac7m$8r0$1@dont-email.me> <siahul$tb8$1@dont-email.me>
<sisn5m$ni6$1@gioia.aioe.org> <87y27it1mo.fsf@bsb.me.uk>
<sitcfp$1fgs$1@gioia.aioe.org> <86lf3bsbwz.fsf@linuxsc.com>
<0L_5J.44593$rsCb.5791@fx01.iad> <87h7dzgk1k.fsf@nosuchdomain.example.com>
<z786J.143438$rl3.15795@fx45.iad> <87czomhf47.fsf@nosuchdomain.example.com>
<LPf6J.62135$6U3.7179@fx43.iad> <878rz9hmvg.fsf@nosuchdomain.example.com>
User-Agent: slrn/1.0.3 (Darwin)
Lines: 40
Message-ID: <TXv6J.38722$GD7.8414@fx23.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Mon, 04 Oct 2021 05:04:51 UTC
Organization: usenet-news.net
Date: Mon, 04 Oct 2021 05:04:51 GMT
X-Received-Bytes: 2346
 by: Branimir Maksimovic - Mon, 4 Oct 2021 05:04 UTC

On 2021-10-03, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
>> On 2021-10-03, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>> Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
>>>> On 2021-10-02, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>>> Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
>>> [...]
>>>>>> Please take a look at this video carefully:
>>>>>> https://youtu.be/094y1Z2wpJg
>>>>>
>>>>> Why?
>>>>>
>>>>> (It's about the Collatz Conjecture, and it's more than 20 minutes long.)
>>>>>
>>>> So do you have *explanation*?
>>>
>>> For what?
>>>
>>>> Why do you ask about negative primes?
>>>
>>> I didn't.
>>>
>>> Is there anything in the video that's relevant either to this newsgroup
>>> or to this thread? If so, what?
>>>
>> Sorry, that was Ttim Rensch i replied, you just replied
>> on something wasn't you asked for :P
>
> So you posted a link to a 20-minute video with no explanation, and
> you're still unwilling to explain how or whether it's relevant.
>
It shows two things: math is connected to reality,
and second, explains why strong AI is impossible :P

--

7-77-777
Evil Sinner!
to weak you should be meek, and you should brainfuck stronger
https://github.com/rofl0r/chaos-pp

Pages:12345
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor