- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
#include<thread>
void f();
struct F {
void operator()();
};
int main()
{
std::thread t1{f}; // f() executes in separate thread
std::thread t2{F()}; // F()() executes in separate thread
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+162
#include<thread>
void f();
struct F {
void operator()();
};
int main()
{
std::thread t1{f}; // f() executes in separate thread
std::thread t2{F()}; // F()() executes in separate thread
}
Фигурные скобочки t1{f}; , используемые где только можно не перестают доставлять.
http://www2.research.att.com/~bs/C++0xFAQ.html
http://www.govnokod.ru/7600#comment103352
пора регистрировать CPPGovnoGovnoGovno? = )
лично меня это не так расстроило, я и так знал, что ципупу - говно.
"~bs"? BS? B.S.? Bull shit?
это че англецкий аналог ГК?
нигде не встречали адекватного объяснения?
Preventing narrowing
The problem: C and C++ implicitly truncates:
int x = 7.3; // Ouch!
void f(int);
f(7.3); // Ouch!
However, in C++0x, {} initialization doesn't narrow:
int x1 = {7.3}; // error: narrowing
double d = 7;
int x2{d}; // error: narrowing (double to int)
char x3{7}; // ok: even though 7 is an int, this is not narrowing
vector<int> vi = { 1, 2.3, 4, 5.6 }; // error: double to int narrowing
C++ требуется еще одна разновидность скобочек )