C++ Logo

std-discussion

Advanced search

Re: Global array of objects over multiple files

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sat, 19 Oct 2024 21:35:16 -0700
On Saturday 19 October 2024 12:59:31 GMT-7 Federico Kircheis via Std-
Discussion wrote:
> const std::string answer_of_life = "42";
>
> This line of code, a global constant std::string, can lead to undefined
> behavior.

You mean an One-Definition Rule violation? That's IFNDR in the Standard.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2024-10-20 04:35:19