Comment by HolyBlackCat on Are variables formally a compile-time concept?
@463035818_is_not_an_ai That is because int x; is spelled twice in the source code. If it's spelled once, then under a certain interpretation it's the same variable.
View ArticleComment by HolyBlackCat on Are variables formally a compile-time concept?
Yeah, this is true, but this isn't what I'm asking. I can add some non-trivial use of x to the example and the problem will stay the same. And in general I'm asking about the definitions used by the...
View ArticleAnswer by HolyBlackCat for What do each memory_order mean?
Firstly...Things to ignore:memory_order_consume - apparently no major compiler implements it, and they silently replace it with a stronger memory_order_acquire. Even the standard itself says to avoid...
View ArticleComment by HolyBlackCat on Why ternary operator cannot be used for this...
"does it mean the ternary operator is evaluated as a separate part" Yes, and in general the way (sub)expressions are evaluated doesn't take into account the context they appear in.
View ArticleComment by HolyBlackCat on Is std::hardware_destructive_interference_size...
I don't know much about, but I remember people complaining about them being constexpr, because supposedly they can only be determined properly at runtime.
View ArticleComment by HolyBlackCat on IMG_LoadTexture() fails to load PNG?
In the future, please add @username when replying. Otherwise we don't receive notifications.
View ArticleComment by HolyBlackCat on pointer-to-member syntax difference in g++ 13...
Doesn't work in GCC 14 either: gcc.godbolt.org/z/P5haG1Meq This is invalid C++ either way, non-static member functions must be either called or have their address taken on use.
View ArticleAnswer by HolyBlackCat for What is the category of iota_view iterator?
In addition to what the other answer says, I'd like to point out that there are two parallel iterator classification systems now.You're looking at the old-style iterator category, but it doesn't make...
View ArticleAnswer by HolyBlackCat for pointer-to-member syntax difference in g++ 13...
This is invalid C++. This works for you because MinGW GCC implicitly enables -fms-extensions (imitating MSVC's non-standard features).I doubt this is new in GCC 14. I don't have a MinGW GCC 13 at hand...
View ArticleAnswer by HolyBlackCat for Only copiable type not accepted in msvc...
TL;DR: This is a poorly written class.Copyable classes shouldn't actively resist moving, even if they don't want to have any custom move behavior.Instead they should let moving fall back to copying,...
View ArticleComment by HolyBlackCat on How are datatypes initialized?
Magic. If you're making classes, you can customize how they are initialized, but int isn't a class, it's built into the language.
View ArticleComment by HolyBlackCat on How to Use Clangd correcly without compile from...
Normally clangd works without any compilation, but I don't know how modules affect this. They are still pretty new and half-baked.
View ArticleComment by HolyBlackCat on Why the first on is true and next is false?
"What is on?" Clearly a string when not surrounded by ${...}, and a variable name when surrounded. But you seem to already know that.
View ArticleAnswer by HolyBlackCat for How to transform a world space position to a...
P == R * localP + CP - C == R * localP + C - CP - C == R * localPinv(R) * (P - C) == inv(R) * R * localPinv(R) * (P - C) == localP
View ArticleComment by HolyBlackCat on Does the standard require `operator->()` to be...
It's relatively simple to implement -> for iterators that return by value from *. You just return a proxy by value from -> that contains the value and also overloads its own -> to return a...
View ArticleComment by HolyBlackCat on GLB model renders incorrectly?
Stackoverflow doesn't really work for those kinds of questions (debugging large programs). It's more for explaining specific language features or short pieces of code. You could try asking e.g. on...
View ArticleComment by HolyBlackCat on I got error after linking GLFW library using Makefile
This is typically caused by using x32 libraries with x64 compiler or vice versa. Either find a different version of glfw matching your compiler, or better replace w64devkit with MSYS2, because that...
View ArticleComment by HolyBlackCat on A class has many public functions; after moving...
You don't have to write new functions in the derived class. You can use public: using Foo::some_func; to make the inherited protected functions public. Or alternatively consider the good ol'...
View ArticleComment by HolyBlackCat on `return type is incomplete` error for a class ,...
This typically happens due to circular includes.
View ArticleComment by HolyBlackCat on Assignment in (else) if statement triggers warning...
Correct about what? Yes, one i hides another. But compilers are free to warn or not warn on anything they want.
View Article