Today's episode of “something I didn't know about C++”: class whynot { friend void; };
-
-
Today's episode of "something I didn't know about C99": error: parameter name omitted int main(int, char**) { ^ All function parameters must be named
pic.twitter.com/aDjjCxYySw
Prikaži ovu nit -
Today's episode of "something I didn't know about C++": you can have a declaration in a for-loop's *condition*
void use(unique_ptr<int>);
void drain(vector<unique_ptr<int>> v) {
for (int i = 0; auto el = move(v[i]); ++i)
use(move(el));
} // https://godbolt.org/z/ug2827 Prikaži ovu nit -
Today's episode of "something I didn't know about C++": template<class ...Ts> void ellipsis(Ts......); Template parameter pack, followed by C-style varargs that doesn't use the (optional!!!) comma.
Prikaži ovu nit -
Today's second episode of "something I didn't know about C++": operator auto() It's a thing. It has (inadvertent) meaning. h/t
@AlisdairMeredPrikaži ovu nit -
Today's episode of "something I didn't know about C": union U { int : 0; }; Unions can contain bit-fields, including zero-sized anonymous bit-fields (which in a class makes the next bit-field start at an allocation unit's boundary, in a union… nothing).
Prikaži ovu nit -
Today's episode of "something I didn't know about C and C++": int size() { struct empty {}; return sizeof(struct empty); } This code returns 0 in C and 1 in C++, because empty structs have different size in both languages.
Prikaži ovu nit -
Today's episode of "something I never imagined that I would see in real C++ code":
#pragma clang diagnostic error "-Weverything"
Prikaži ovu nit -
Today's episode of "something I didn't know about C++": falling off the end of a function try block does an implicit rethrow for constructors and destructors, but falls off the end of the function otherwise (which only main turns to an implicit `return 0;`). h/t
@MalwareMinigunpic.twitter.com/9U7DS2VcS0
Prikaži ovu nit -
Today's episode of "something I thought only browsers did and surely C++ compilers didn't": clang's __VERSION__ emulates GCC's and prints out as: "4.2.1 Compatible Clang 9.0.0 (trunk 355887)" Just like browser User-Agent string!pic.twitter.com/UcJmhf6LBa
Prikaži ovu nit -
Today's episode of "something I didn't know about C (but not C++!)": you can define a type in offsetof and in casts!
int o = offsetof(struct S { int a; }, a);
Macro expands to:
((size_t)&(((struct S { int a; } *)0)->a))
Watch those commas though! Likely fixed in C2x.Prikaži ovu nit -
Today's episode of "something from C99 making its way into a weird C++ extension": using abominable = void() const const const const const const const volatile volatile volatile volatile volatile &&;https://twitter.com/jfbastien/status/1113560327583453186 …
Prikaži ovu nit -
Today's episode of "something that endlessly amuses me about the C++ Standard": "Stable names" for sections of the Standard include [over.ass] and [expr.ass]. Hehe, ISO-standard ass. /cc
@xexd http://eel.is/c++draft/over.ass … http://eel.is/c++draft/expr.ass …Prikaži ovu nit -
Today's episode of "something I didn't know about C++ constexpr": case labels can be constant expressions. Unfortunately, they can't be recursive
https://godbolt.org/z/Ye5Tid pic.twitter.com/B6H8uIz2pu
Prikaži ovu nit -
Most interesting question: what's the order of evaluation of constexpr case labels?
Prikaži ovu nit -
Today's episode of "GCC tries to pull heroics in constexpr statement expressions". Can you guess which value gets picked? https://godbolt.org/z/NtlPkm pic.twitter.com/cn6DnglxnP
Prikaži ovu nit -
Today's episode of "something I didn't know about C++ type traits": is_constructible<T, Args...> is true if the type is constructible... as well as destructible! It's not true if the type is constructible but not destructible.pic.twitter.com/d9vA5MnBVm
Prikaži ovu nit -
Today's episode of "fun clang extension to C++": duplicate qualifiers without typedefs. const const const const int const const const const CONSTANT_FORTRESS = 0;
Prikaži ovu nit -
Today's episode of "something I didn't know about C++" You can: ⁃ delete operator new ⁃ delete operator delete *Cannot* new operator new. struct S { void* operator new(size_t) = delete; void operator delete(void *) = delete; void* operator new(size_t) = new; // No! };
Prikaži ovu nit -
Today's episode of "something I didn't know about GNU C extensions": There's a feature called "GNU case range extension" enum enumeration { A, B, C, D, BORING }; int amazing(enumeration amaze) { switch (amaze) { case A ... D: return 42; case BORING: return 0; } }
Prikaži ovu nit
Kraj razgovora
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.
—
C++ standards committee language evolution chair