C++ Logo

std-proposals

Advanced search

Re: [std-proposals] value-changing implicit conversions

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Wed, 11 Dec 2024 21:02:44 +0000
Ideally variable conversion rules should be different. I personally wouldn't mind working with a version of the language where no implicit conversion can take place.
If you want different types to interact you would need to explicit cast it to the right type that should be interpret as.
But I would assume that this would get a lot of pushback as it would not only make it extremely not beginner friendly but also less compatible with C.
It would catch a lot of bugs for sure, but it would be almost impossible to adopt, that will need to be a different programming language I'm afraid.


-----Original Message-----
From: Std-Proposals <std-proposals-bounces_at_lists.isocpp.org> On Behalf Of Magnus Fromreide via Std-Proposals
Sent: Wednesday, December 11, 2024 6:46 PM
To: std-proposals_at_lists.isocpp.org
Cc: Magnus Fromreide <magfr_at_[hidden]e>
Subject: [std-proposals] value-changing implicit conversions

On Tue, Dec 10, 2024 at 06:31:59PM -0500, Tom Honermann via Std-Proposals wrote:
> On 12/10/24 5:55 PM, Andrey Semashev via Std-Proposals wrote:

> > No, the fix is to resolve problems of poor interaction between
> > signed and unsigned integers in the language. And the OP doesn't propose that.
>
> We can't feasibly fix that in the core language (other than by
> providing some kind of opt-in like new types, epochs, or profiles).

But it still feels feasible to have a mode/profile/whatever where value-changing implicit conversions are erraneous.

That feels like it could catch a lot of bugs, and not only in array indexing.

/MF
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-12-11 21:02:50