- 1
- 2
- 3
- 4
- 5
template<class Container>
void COW_guard(Container& forUnCow){
const Container c={};
cc+=c;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+17
template<class Container>
void COW_guard(Container& forUnCow){
const Container c={};
cc+=c;
}
+73
http://bnw.im/p/JCBN9N
https://bnw.im/u/j123123
+17
cKeyCfg::types_t cConfiguration::SearchInType(string type)
{
CTint i = 0;
const CTbyte * types[] = { "S", "D" };
for(i = 0; i < sizeof(types)/sizeof(types[0]); i++) {
if ( strcmp(type.c_str(),types[i]) == 0) {
switch (i) {
case 0: // Is string
return cKeyCfg::stringa;
case 1: // Is decimal
return cKeyCfg::decimale;
default: //Default value VT_BSTR
return cKeyCfg::unknow;
}
}
}
return cKeyCfg::unknow;
}
сделано на родине Fiat'а.
+15
tblib::operator << (s, curVersion);
tblib::operator << (s, indPlayer);
tblib::operator << (s, indDiamond);
tblib::operator << (s, indDisk);
tblib::operator << (s, indExit);
tblib::operator << (s, indDust);
Нельзя просто взять, и написать
s << curVersion << indPlayer << indDiamond << indDisk << indExit << indDust;
потому что глючный крестоблядский крестокомпилятор (MSVS-03) не может выбрать нужную крестоперегрузку.
"Сразу записать инт, или сначала кастануть его к жопе и записать жопу?"
+63
template <typename T>
void function_name(T &&data)
{
static_assert(std::is_rvalue_reference<decltype(data)>::value, "data must be rvalue");
// ...
}
Все лишнее убрано
+59
#include <iostream>
using namespace std;
int main()
{
setlocale(0, "");
int a, b;
cout << "Vvedite pervoe chislo: ";
cin >> a;
cout << "Vvedite vtoroe chislo: ";
cin >> b;
int c, d, e, f, h;
cout << "Vvedite gelaemuy operaciu: ";
cin >> c, d, e, f;
if (c)
{
h = a + b;
}
else
{
if (d)
{
h = a - b;
}
else
{
if (e)
{
h = a * b;
}
else
{
if (f)
{
h = a / b;
}
}
}
}
cout << "Rezultat: " << h << endl;
return 0;
}
+90
const struct TExceptionSafety {
TQueue& _queue;
::std::condition_variable& _pushToQueue;
~TExceptionSafety(){
if(!this->_queue.empty())
this->_pushToQueue.notify_one();
}
} exceptionSafety = {_queue, _pushToQueue};//Use BOOST_SCOPE_EXIT, Luke!
+66
int array[100];
//~=//=~
for(i=0;i<100;++i)
{
if(array[i] != 0) continue;
break;
}
Код ужасно упрощен, но смысл передан полностью. Как я такое написал хз.
+68
#include <iostream>
using namespace std;
unsigned ololo_div(unsigned what, unsigned by) {
unsigned cnt=0;
while( what>by ) {
what-=by;
cnt++;
}
if( what==0 ) cnt++;
return cnt;
}
int main() {
cout << ololo_div(10,0) << endl;
return 0;
}
"че там делить то)))"
http://codepad.org/nL06uX2s
+64
QSqlQuery my_query;
my_query.prepare(
QString("INSERT INTO table1 (number, address, age) VALUES (%1, '%2', %3);")
.arg(fromInput1).arg(fromInput2).arg(fromInput3)
);
Жаль, но похоже автор не осилил экранирование от SQL-иньекций.