C++ Logo

std-proposals

Advanced search

Re: [std-proposals] TBAA and extended floating-point types

From: Simon Schröder <dr.simon.schroeder_at_[hidden]>
Date: Sat, 30 Aug 2025 13:41:46 +0200
> On Aug 26, 2025, at 10:55 PM, Sebastian Wittmeier via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> 
> I can understand some general reasons for the push-back on allowing aliasing.
>
>
>
> But specifically double and std::float64_t on platforms, where they have the same representation:
>
>
>
> What is gained by disallowing aliasing? Wouldn't it just be defined as a typedef on those platforms?
>
What is gained? Portability! It would mean your code does not stop working some time in the future just because the underlying hardware changes.

I am working on simulation code that is more than 40 years old. (This also means a lot of it is still Fortran.) There are some places where there is an implicit assumption on 32-bit platforms. It still works with the Intel Fortran compiler on 64-bit systems. But, the code is not standard anymore. This means that currently it is not portable to macOS on ARM. (I can’t directly use the Intel compiler to produce ARM code.)

If the computing platform changes in the future, it would be nice if the code still works. On the other hand it is really unlikely that the meaning of float or double will change (at least on desktop computers and compute clusters). Too much software has already been written. In my mind ‘int’ was meant to be the native size of integers. But, nobody dared to change it to 64 bit on modern computers. Too much software relies on it to be 32 bits.
> You find yourself agreeing (with disallowing), can you explain?
>
>

Received on 2025-08-30 11:42:00