Jun
28 |
|
asked | Why all my windows refresh and stutter every half hour, at exactly 00 and 30 minutes? |
Jun
28 |
|
answered | Why all my windows refresh and stutter every half hour, at exactly 00 and 30 minutes? |
Jun
22 |
|
comment |
Can the C++ compiler coalesce adjacent mutex locks? I suspect there might be some wording about mutex (un)locking being a visible external effect akin to I/O, e.g. [intro.progress]/1 lists both.
|
Jun
16 |
|
comment |
How much slower is pointer arithmetic vs using a pointer? No way to tell, modern compilers and CPU have a lot of optimizations built it. The same C code may be slower/faster in different contexts. Unless you're working with an old compiler that always generates exactly the same predicable assembly, and your CPU has exact timings for all assembly, I wouldn't bother. Optimize for readability and communicating the intention, do not nitpick optimizations. |
Jun
10 |
|
comment |
Are "Is my understanding correct" questions appropriate? @TylerH Unless it's a C++ question. A lot of incorrect C++ programs appear to be correct when testing on a specific machine. |
May
31 |
|
comment |
Denied boarding on RyanAir intra-Schengen despite valid German Residency travel documents Out of curiosity: do you have any confirmation that you've indeed talked to the agent and was denied boarding due to your documents, and not just e.g. never even tried to check in? I'd expect that would be the easiest way out for the airline. |
May
24 |
|
awarded | Yearling |
May
24 |
|
awarded | Yearling |
May
21 |
|
comment |
Clarification needed about my Schengen visa (CZ, DE, SK) For example, Denmark does not accept non-biometric Russian passports with 5 years validity, while biometric passports with 10 years validity are ok. Hence, visas for the former are typically issued with -DK .
|
May
19 |
|
comment |
MSVC constexpr error "a non-constant (sub-)expression was encountered (with no info) (works on Clang!) @JaMiT You can also remove comments, the destructor, and replace the long array of size_t with int arr[] = {1}
|
May
19 |
|
revised |
MSVC constexpr error "a non-constant (sub-)expression was encountered (with no info) (works on Clang!) Embed source code in the question |
May
19 |
|
comment |
MSVC constexpr error "a non-constant (sub-)expression was encountered (with no info) (works on Clang!) Note that it's enough to remove all template parameters and fields from StaticArray , as well as the whole implementation of the constructor.
|
May
18 |
|
comment |
MSVC constexpr error "a non-constant (sub-)expression was encountered (with no info) (works on Clang!) Thanks a lot for providing a link to Godbolt, but please embed everything needed to answer the question into the question's body itself. Links tend to expire. |
May
16 |
|
comment |
In C++, could a thread waiting for conditional variable notify itself? Your thread does not wait when it calls notify_one . Hence, it cannot be notified at all. Someone else will be. If you want wait() to be woken up by sender() , you should really include that into predicate somehow to have a precise semantics. Otherwise, it all seems very TOCTOU-prone tome.
|
May
13 |
|
comment |
C++ Unions: Accessing non-active array element guaranteed to not share space Maybe it is ok to read byte representation of the whole union U with reinterpret_cast . It's not a strict aliasing violation, but I'm not sure whether it's ok to access byte representation of an inactive member.
|
May
13 |
|
comment |
C++ Unions: Accessing non-active array element guaranteed to not share space In standard C++, that is UB, no way around it. Whatever any specific compiler does is up to that specific compiler. Whether you can rely on a compiler "to do a sensible thing" is up to you. I would not if I assume the code will live through at least one compiler's major version upgrade. |
May
10 |
|
comment |
Cannot insert keys and values in a map @tadm123 Not declaring any constructors here would be equivalent to only defining the default constructor. So it would work. As you've added a user-defined constructor, the default constructor is now not implicitly generated by the compiler. Hence the error. |
May
6 |
|
comment |
Why can't you initialize a single row of a 2d array in c++? Works just fine for vector<> s instead of C-style arrays (but not because it's explicitly handled, as a part of bigger features). For arrays, just not in the standard. It was not in C initially, was not added in C++, and nobody got to publishing a corresponding proposal and pushing it through compiler vendors and the committee since.
|
Mar
20 |
|
comment |
Valgrind error when loading font in SFML project What if you completely remove all the lines except loading the font? What if you remove just the inner while ? What if you don't draw any shapes? Can the example be minified even more somehow?
|
Mar
16 |
|
comment |
Printf changes the outcome the program Only reading the title: undefined behavior is highly likely. Like array out of bounds, no return in a function or something similar. Try compiling your program with Address Sanitizer (-fsanitize=address for GCC).
|