Date: Mon, 1 Sep 2025 01:58:33 -0400
On Mon, Sep 1, 2025 at 1:33 AM Tiago Freire via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> > You want to have your cake and eat it too: have fast and cross-platform basic algorithms. You usually can't have both.
>
> But that's precisely what I want to solve.
> I can provide multiple implementations.
>
> If I can test what is the target platform, I can pick the best implementation. If you don't have the hardware you get the "generic but at least it works" implementation, but if you do you can get the better version for your hardware.
>
> You would still end up with a cross-platform library, from a user's perspective it still works everywhere, but it is internally built with non-portable components. And that is fine because you can just swap those components.
>
> But if I have to go to every single compiler vendor to figure out how to do this test, it becomes much harder.
The standard cannot tell you what the actual behavior of these things
are because they're platform-specific. So you'd still need to "go to
every single compiler vendor to figure out how" to *implement* the
platform-specific code. I feel like testing what the platform is is a
minor issue next to figuring out how to best use that platform's
tools.
<std-discussion_at_[hidden]> wrote:
>
> > You want to have your cake and eat it too: have fast and cross-platform basic algorithms. You usually can't have both.
>
> But that's precisely what I want to solve.
> I can provide multiple implementations.
>
> If I can test what is the target platform, I can pick the best implementation. If you don't have the hardware you get the "generic but at least it works" implementation, but if you do you can get the better version for your hardware.
>
> You would still end up with a cross-platform library, from a user's perspective it still works everywhere, but it is internally built with non-portable components. And that is fine because you can just swap those components.
>
> But if I have to go to every single compiler vendor to figure out how to do this test, it becomes much harder.
The standard cannot tell you what the actual behavior of these things
are because they're platform-specific. So you'd still need to "go to
every single compiler vendor to figure out how" to *implement* the
platform-specific code. I feel like testing what the platform is is a
minor issue next to figuring out how to best use that platform's
tools.
Received on 2025-09-01 05:58:45