Affective C++ retweeted
On x86, the stack grows “down” towards lower addresses. However, this is only true in the northern hemisphere due to the Coriolis effect. In Australia, the stack grows up actually. That’s because they are all looking at their monitors upside down to avoid falling off the planet.
Affective C++ retweeted
Replying to @david_m_stone
But `unsigned const int` is not the same as `const unsigned int` nor `unsigned int const`.
For east-const builds unsigned const int makes the high bit read-only.
For west-const builds it makes everything *except* the high bit read-only.
We rejected central due to the ambiguity.
Affective C++ retweeted
Replying to @ciura_victor
Pro-tip: Commas are quicker to parse than semi-colons because there are less pixels in the character. @AffectiveCpp
Affective C++ retweeted
Replying to @AffectiveCpp
@AffectiveCpp this is how the professionals structure projects.
Affective C++ retweeted
programming protip! when you see x >= 0, that's a handy shortcut for
x = x > 0
Affective C++ retweeted
Replying to @bjorn_fahller @AffectiveCpp
The other advantage is that it forces you to keep the number of local variables down to a manageable 26 or less.
Affective C++ retweeted
One more for @AffectiveCpp:
“Magic constants are the best gift you can leave your colleagues in a codebase.
They are great because they immediately stick out and make one think/understand the code using them.”
You’re welcome 🤡
#cpp
Affective C++ retweeted
Replying to @AffectiveCpp @olafurw
For maximum effectiveness it is recommended to reinterpret_cast the results in to the desired memory layout to improve performance #affectivecpp
Affective C++ retweeted
C++ #protip: make your code nicer by adding some nice garlands to your variables like this
*&*&*&*&*&*&var = *&*&*&*&*&*&*&a +*&*&*&*&*&*&b
Affective C++ retweeted
Replying to @vzverovich @lefticus
for (int ı = 0; ı < max; ı++) {
for (int i = 0; i < mȧx; i++) {
for (int ï; ï < mäx; ï++) {
/* ... */
}
}
}
Affective C++ retweeted
Replying to @AffectiveCpp
Further confirmed by this idiom called SFINAE: std::flush Intermittently Normalizes Any Errors !
#affectivecpp #cppsecrets
Affective C++ retweeted
Replying to @AffectiveCpp
Just use:
char scratchpad[256];
char * s = scratchpad;
void foo()
{
char * p = s;
s += 8;
*(int *)p = 1;
*((int *)p+1) = 2;
...
s -= 8;
}
etc.
Affective C++ retweeted
Since it's CppCon time, we need to be reminded of this wonderful thread.
xitter.cf/JamesMcNellis/status/1…
Affective C++ retweeted
Replying to @hankadusikova
For similar reason, RESTful APIs should be public member functions if they are internet-facing and private otherwise. Is this wisdom captured yet, @AffectiveCpp?
Affective C++ retweeted
Parallelize your hello world program for better performance! #programmingtips
Affective C++ retweeted
The nice thing about writing a library that is almost completely templates: you have really high code coverage by default.
Functions are only measured if you have a test that instantiates them. If you want 100% code coverage, just delete all tests!
Affective C++ retweeted
Replying to @tvaneerd @vzverovich
The non-const version should return false because the two values aren't really equal, they are just temporarily the same. At some point they will be different. The have different futures ahead of them, thus they must be somehow inherently different even now.
Whereas the const...
Affective C++ retweeted
Hey, cool. Google has the correct twitter account for the first result. @AffectiveCpp
Hey, cool. Google also has the correct twitter account for the 2nd result... @visualc :P
Affective C++ retweeted
Replying to @Cor3ntin @vzverovich
Affective C++ retweeted
Replying to @AffectiveCpp @olafurw
I prefer std::wstring with XML based serialization




















