- 1
- 2
- 3
- 4
- 5
- 6
- 7
bool MyClass::operator==(int elem){
if (list.isExist(elem)){
list.remove(elem);
return true; // Операция завершена успешно
}
return false; // Элемент elem не найден в списке
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+4
bool MyClass::operator==(int elem){
if (list.isExist(elem)){
list.remove(elem);
return true; // Операция завершена успешно
}
return false; // Элемент elem не найден в списке
}
(C) https://www.linux.org.ru/forum/development/14063699?cid=14063991
Вырвано из контекста (треда), но считаю данная кучка должна лежать здесь.
0
new Template('device.matrix.container').load(function (container_tpl) {
new Template('device.matrix.device').load(function (device_tpl) {
new Template('device.matrix.port').load(function (port_tpl) {
new ApiCall('device.matrix.list')
.set('house', event.house_id)
.do(function (r) {
// Do anything
})
});
});
});
How don't need to write JS.
+9
Argument type mismatch
Assertion failed
+10
var
DPen: TGPPen;
Drawer: TGPGraphics;
DBrush: TGPSolidBrush;
DFntFam: TGPFontFamily;
DPath: TGPGraphicsPath;
IC,BC:Integer;
ICL, BCL:TGPColor;
W:WideString;
si:TGPRectF;
rt:TGPRectF;
GP:TGPPoint;
begin
W:=FWaterMark.Text;
IC:=ColortoRGB(FWaterMark.Font.Color);
BC:=ColorToRGB(FWaterMark.CircuitColor);
ICl:=MakeColor(GetRValue(IC), GetGValue(IC), GetBValue(IC));
BCL:=MakeColor(GetRValue(BC), GetGValue(BC), GetBValue(BC));
Drawer:=TGPGraphics.Create(FBitMap.Canvas.Handle);
Drawer.SetCompositingQuality(CompositingQualityHighQuality);
Drawer.SetSmoothingMode(SmoothingModeAntiAlias);
Drawer.SetTextRenderingHint(TextRenderingHintAntiAlias);
DPath:=TGPGraphicsPath.Create;
DPen:=TGPPen.Create(BCL, FWaterMark.FCircuitWidth);
DBrush:=TGPSolidBrush.Create(ICL);
DFntFam:=TGPFontFamily.Create(FWaterMark.Font.Name);
RT.X:=0;
RT.Y:=0;
RT.Width:=FBitMap.Width;
RT.Height:=FBitMap.Height;
DPath.AddString(W, Length(W), DFntFam, FontStyleBold, FWaterMark.Font.Size, GP, TGPStringFormat.Create());
DPath.GetBounds(RT, nil, DPen);
DPath.Reset;
//В общем, хз, как узнать ширину и высоту нарисованного.
//MeasureString/MeasureCharacterRanges не подходят,а в доке такая муть, что я чуть не спился.
Нежнейший аромат...
+2
// https://github.com/Samsung/ADBI/blob/3e424c45386b0a36c57211da819021cb1929775a/idk/include/division.h#L138
/* Long division by 10. */
static unsigned long long int div10l(unsigned long long int v) {
/* It's a kind of magic. We achieve 64-bit (long) division by dividing the two 32-bit halfs of the number 64-bit
* number. The first (most significant) half can produce a rest when dividing, which has to be carried over to the
* second half. The rest_add table contains values added to the second half after dividing depending on the rest
* from the first division. This allows evaluation of a result which is almost correct -- it can be either the
* expected result, or the expected result plus one. The error can be easily detected and corrected.
*/
/* one dream */
static unsigned long long int rest_add[] = {
0x00000000, 0x1999999a, 0x33333334, 0x4ccccccd, 0x66666667,
0x80000001, 0x9999999a, 0xb3333334, 0xcccccccd, 0xe6666667
};
/* one soul */
unsigned long long int a = div10((unsigned int)(v >> 32));
unsigned long long int b = div10((unsigned int)(v & 0xffffffff));
/* one prize */
int ri = (v >> 32) - a * 10;
/* one goal */
unsigned long long int ret = (a << 32) + b + rest_add[ri];
/* one golden glance */
if (ret * 10L > v) {
//printf("OGG %llu %llu\n", ret * 10, v);
--ret;
}
/* of what should be */
return ret;
}
Деление на 10. Но зачем? Неужели компилятор настолько туп, что сам не может этого сделать?
И да, эти туповатые комментарии one dream, one soul это отсылка к песне Queen - A Kind of Magic https://youtu.be/0p_1QSUsbsM
0
https://habrahabr.ru/post/348744/
Обнаружен пидар.
+6
data Foo a = Foo {a :: a, b :: Int}
| Bar {b :: Int}
foo :: (a -> b) -> Foo a -> Foo b
foo f x@Foo{a = a} = x{a = f a}
foo _ x@Bar{} = x -- error: Couldn't match type ‘a’ with ‘b’
foo _ x@Bar{} = x{} -- error: Empty record update
Рекорды всё-таки дубовые
cast @HaskellGovno
−1
var i, j;
loop1:
for (i = 0; i < 3; i++) { //The first for statement is labeled "loop1"
loop2:
for (j = 0; j < 3; j++) { //The second for statement is labeled "loop2"
if (i === 1 && j === 1) {
continue loop1;
}
console.log('i = ' + i + ', j = ' + j);
}
}
Метки в js. Баян?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label
−2
Что за браузер?
−1
#include <iostream>
using namespace std;
struct MyType { MyType() { cout << __PRETTY_FUNCTION__ << endl; }};
MyType& MyType() { cout << __PRETTY_FUNCTION__ << endl; }
using MyType2 = struct MyType;
int main() {
// MyType t; <- error: expected ‘;’ before ‘t’
MyType();
struct MyType t;
struct MyType t1 = MyType();
struct MyType t2 = (struct MyType)::MyType();
struct MyType t3 = MyType2();
new(&t2) struct MyType();
return 0;
}
Крестоблядство по мотивам #23850.
https://ideone.com/XcK2hf.
Особенно меня порадовал каст на 11 строчке.