The One-Definition Rule--Andrzej Krzemieński

Something we should be aware of:

The One-Definition Rule

by Andrzej Krzemieński

From the article:

We have been hit by the same bug twice already this year. It ends in a crash, and it took developers days to find it (in each case), even though it is reproducible on each run of unit tests. The code, after significant simplifications, looks like this:

namespace tests
{
  struct Fixture
  {
    std::vector<int> v1;
    std::vector<int> v2;

    static Fixture create();
  };

  TEST_CASE(test1)
  {
    auto fixture = Fixture::create();
    std::cout << "running test1";
  }
}

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.