C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Automatic perfect forwarding is possible and not too complicated

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 10 Apr 2025 14:19:42 +0100
On Thu, Apr 10, 2025 at 2:06 PM Bo Persson via Std-Proposals wrote:
>
> This is a very big deal where I come from. Having code do different
> things in test and production environments is a big no-no. What have we
> tested?!


Anyone who's been programming in C++ for more than a year or two has
come across a few strange situations, such as:

    Scenario 1) Program malfunctions in Debug mode, but runs fine in
Release mode
    Scenario 2) Program runs fine in Debug mode, and malfunctions in
Release mode

To answer your question Bo, you asked "What have we tested?!", well
the answer is as follows:
    "If you tested the Debug mode build, then you tested the Debug
mode build. If you tested the Release mode build, then you tested the
Release mode build."

Typically here's how I operate when I write a new program:
  Step 1 - Test the Debug mode binary on my dev laptop (x86_64)
  Step 2 - Test the Debug mode binary on 27 cross-compilers with Qemu
  Step 3 - Test the Release mode binary on my dev laptop (x86_64)
  Step 4 - Test the Release mode binary on 27 cross-compilers with Qemu

If the Debug mode binary and also the Release mode binary run fine on
two dozen different architectures (big endian, little endian, 32-bit
pointers, 64-bit pointers, stack grows up, stack grows down), then I'm
on to a winner.

But there will always be a caveat in all of this: Just because the
Debug mode binary runs fine, doesn't mean the Release mode binary will
run fine. And vice versa.

Received on 2025-04-10 13:19:54