- 1
Argument type mismatch
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+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 строчке.
0
// ==UserScript==
// @name syomaGKignore
// @description x-cross to ban GK users for syoma
// @version 0
// @match http://govnokod.ru/*
// @match http://www.govnokod.ru/*
// @grant none
// ==/UserScript==
window.addEventListener('load', function() {
localStorage.setItem('banned', localStorage.getItem('banned') || JSON.stringify([]));
var banned = JSON.parse(localStorage.getItem('banned'));
for (var i = 0; i < banned.length; i++) {
var hide = document.querySelectorAll('.entry-author a[href$="/' + banned[i] + '"]');
for (var j = 0; j < hide.length; j++) {
hide[j].parentNode.parentNode.parentNode.style.display = 'none';
}
}
var count = document.querySelector('.enrty-comments-count');
count.style.cursor = 'pointer';
count.addEventListener('click', function() {
localStorage.setItem('banned', JSON.stringify([]));
location.reload();
});
var votes = document.querySelectorAll('.comment-vote');
for (var i = 0; i < votes.length; i++) {
var cross = document.createElement('div');
cross.innerHTML = '☓';
cross.style.display = 'inline-block';
cross.style.color = 'black';
cross.style.marginLeft = '10px';
cross.style.cursor = 'pointer';
cross.addEventListener('click', function() {
var id = this.parentNode.querySelector('.entry-author a').href.replace(/^.*\//, '');
var banned = JSON.parse(localStorage.getItem('banned'));
if (banned.indexOf(id) < 0)
banned.push(id);
localStorage.setItem('banned', JSON.stringify(banned));
location.reload();
});
votes[i].parentNode.insertBefore(cross, votes[i]);
}
});
Крестик для Сёмы на чистейшем JS, без $ и сложных евентов на аяксы. Работает только на страницах конкретных постов (другие и не нужны, с бормандстока кликнул по ссылке — попал куда надо), и только после полной загрузки страницы. Разбанить всех — это клик по цифре с общим количеством комментариев под постом, рядом со ссылкой на RSS.
+2
MyType(const CopyPastedFromSomewhere&) = delete;
MyType& operator=(const CopyPastedFromSomewhere&) = delete;
MyType& operator=(const MyType*) = delete;
// Winner?
MyType& MyType(const MyType&) = delete;
А что можно найти в вашей кодовой базе? К слову, выяснилось, что вариант
void operator=(const MyType&) = delete;
вполне себе допустим.