On 28.03.2025 13:59, Bonita Montero wrote:
Am 28.03.2025 um 12:03 schrieb Paavo Helde:
During some code refactoring I discovered this is compiling without
errors or warnings. I guess this is another nice entry for obfuscated
C+ + quizzes...
#include <iostream>
#include <string>
int foo() {
return 321;
}
int main() {
std::string name;
name = foo();
std::cout << name << std::endl;
}
Maybe I'd got it if I'd be warned with a narrowing warning because
of narrowing from int to chat.
This warning is not activated by common warning settings like -Wall
-Wextra, or /W3, so needs to be switched on first (and then one must
clean up the codebase to get rid of the myriad of false alarms).
For reference, the narrowing warning is called -Wconversion in gcc and
C4242 in MSVC (`#pragma warning(default: 4242)`).
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)