- 1
- 2
- 3
- 4
- 5
- 6
- 7
while ( port->available() )
{
au8Buffer[ u8BufferSize ] = port->read();
u8BufferSize ++;
if (u8BufferSize >= MAX_BUFFER) bBuffOverflow = true;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+3
while ( port->available() )
{
au8Buffer[ u8BufferSize ] = port->read();
u8BufferSize ++;
if (u8BufferSize >= MAX_BUFFER) bBuffOverflow = true;
}
Если буфер переполнился – попробуем это запомнить и... продолжим затирать память! Реальный кусок из библиотеки работы с RS485 – протоколом, применяющимся в промышленных контроллерах и все такое.
+2
/* ../COBYLA2/cobyla2.f -- translated by f2c (version 20100827) */
...
/* Subroutine */ int cobyla_(integer *n, integer *m, doublereal *x,
doublereal *rhobeg, doublereal *rhoend, integer *iprint, integer *
maxfun, doublereal *w, integer *iact)
{
static integer ia, idx, mpp, icon, isim, isigb, idatm, iveta, isimi,
ivsig, iwork;
extern /* Subroutine */ int cobylb_(integer *, integer *, integer *,
doublereal *, doublereal *, doublereal *, integer *, integer *,
doublereal *, doublereal *, doublereal *, doublereal *,
doublereal *, doublereal *, doublereal *, doublereal *,
doublereal *, doublereal *, integer *);
/* Parameter adjustments */
--iact;
--w;
--x;
/* Function Body */
mpp = *m + 2;
icon = 1;
isim = icon + mpp;
isimi = isim + *n * *n + *n;
idatm = isimi + *n * *n;
ia = idatm + *n * mpp + mpp;
ivsig = ia + *m * *n + *n;
iveta = ivsig + *n;
isigb = iveta + *n;
idx = isigb + *n;
iwork = idx + *n;
cobylb_(n, m, &mpp, &x[1], rhobeg, rhoend, iprint, maxfun, &w[icon], &w[
isim], &w[isimi], &w[idatm], &w[ia], &w[ivsig], &w[iveta], &w[
isigb], &w[idx], &w[iwork], &iact[1]);
return 0;
} /* cobyla_ */
...
/* Subroutine */ int cobylb_(integer *n, integer *m, integer *mpp, doublereal
*x, doublereal *rhobeg, doublereal *rhoend, integer *iprint, integer *
maxfun, doublereal *con, doublereal *sim, doublereal *simi,
doublereal *datmat, doublereal *a, doublereal *vsig, doublereal *veta,
doublereal *sigbar, doublereal *dx, doublereal *w, integer *iact)
{
/* Format strings */
static char fmt_10[] = "(/3x,\002The initial value of RHO is\002,1pe13.6"
",2x,\002and PARMU is set to zero.\002)";
static char fmt_50[] = "(/3x,\002Return from subroutine COBYLA because t"
"he \002,\002MAXFUN limit has been reached.\002)";
static char fmt_70[] = "(/3x,\002NFVALS =\002,i5,3x,\002F =\002,1pe13.6,"
"4x,\002MAXCV =\002,1pe13.6/3x,\002X =\002,1pe13.6,1p4e15.6)";
static char fmt_80[] = "(1pe19.6,1p4e15.6)";
static char fmt_210[] = "(/3x,\002Return from subroutine COBYLA because"
" \002,\002rounding errors are becoming damaging.\002)";
static char fmt_410[] = "(/3x,\002Increase in PARMU to\002,1pe13.6)";
static char fmt_580[] = "(/3x,\002Reduction in RHO to\002,1pe13.6,\002 "
"and PARMU =\002,1pe13.6)";
static char fmt_590[] = "(/3x,\002Normal return from subroutine COBYL"
"A\002)";
/* System generated locals */
integer sim_dim1, sim_offset, simi_dim1, simi_offset, datmat_dim1,
datmat_offset, a_dim1, a_offset, i__1, i__2, i__3;
doublereal d__1, d__2;
/* Builtin functions */
integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
double sqrt(doublereal);
/* Local variables */
static doublereal f;
static integer i__, j, k, l, mp, np, iz;
static doublereal phi, rho, sum, beta, cmin, cmax;
static integer ivmc;
static doublereal weta;
static integer ivmd;
static doublereal temp, wsig, gamma;
static integer iflag;
static doublereal alpha, delta, denom, tempa, barmu;
static integer nbest, ifull, iptem, jdrop;
static doublereal ratio, vmold, parmu, error, vmnew;
extern /* Subroutine */ int calcfc_(integer *, integer *, doublereal *,
doublereal *, doublereal *);
static integer ibrnch;
static doublereal edgmax, pareta, prerec, phimin, parsig;
static integer isdirn, nfvals, izdota;
static doublereal cvmaxm, dxsign, prerem;
static integer iptemp;
static doublereal resmax, cvmaxp;
static integer idxnew;
static doublereal resnew, trured;
extern /* Subroutine */ int trstlp_(integer *, integer *, doublereal *,
doublereal *, doublereal *, doublereal *, integer *, integer *,
doublereal *, doublereal *, doublereal *, doublereal *,
doublereal *, doublereal *);
/* Fortran I/O blocks */
static cilist io___22 = { 0, 6, 0, fmt_10, 0 };
static cilist io___29 = { 0, 6, 0, fmt_50, 0 };
static cilist io___33 = { 0, 6, 0, fmt_70, 0 };
static cilist io___34 = { 0, 6, 0, fmt_80, 0 };
static cilist io___39 = { 0, 6, 0, fmt_210, 0 };
Найдено в зависимостях «SlangTNG». Библиотека «COBYLA», автоматически переведённая с «Фортрана».
/* This subroutine minimizes an objective function F(X) subject to M */
/* inequality constraints on X, where X is a vector of variables that has */
/* N components. The algorithm employs linear approximations to the */
/* objective and constraint functions, the approximations being formed by */
/* linear interpolation at N+1 points in the space of the variables. */
https://tng.tuxfamily.org/index.php?title=Main_Page
0
https://ru.wikipedia.org/wiki/Деление_с_остатком#В_программировании
Смотрим табличку справа.
Именно поэтому я против PHP
−8
#include <iostream>
using namespace std;
int_main()
{
double a, c;
char b;
cout << "Enter the example: ";
cin >> a, b, c;
if (b == '+')
{
cout << a+c;
}
if (b == '-')
{
cout << a-c;
}
if (b == '*')
{
cout << a*c;
}
if (b == '/')
{
cout << a/c;
}
return 0;
}
Почему не работает парню на SO так и не ответили...
−102
Тест.
−1
if(deliverySuspend == true) {
deliverySuspend = false;
}
else
{
deliverySuspend = true;
}
if(deliverySuspend == false)
{
lastGlucoseMarkerVal = 0.0;
}
Пул реквест с таким куском говна пришел от индуса.
Стилистика и табуляции сохранены.
0
https://forums.e-hentai.org/index.php?showtopic=229503
ExHentai R.I.P
−2
Мне было 8, я видел пхп
Теперь мне 28, а пхп говно
+1
parse: function() {
let c = dstack[dstack.length - 1];
c = c == ' ' ? '\\s' : s.replace(/[^\w\s]/g, '\\$&');
const regex = new RegExp('^[^' + c + ']*', 'g');
const match = regex.exec(rest_source);
dstack.push(match[0]);
rest_source = rest_source.slice(regex.lastIndex, rest_source.length);
output.push(match[0]);
},
word: function() {
let c = dstack[dstack.length - 1];
c = c == ' ' ? '\\s' : s.replace(/[^\w\s]/g, '\\$&');
const regex = new RegExp('^[' + c + ']*', 'g');
const match = regex.exec(rest_source);
rest_source = rest_source.slice(regex.lastIndex, rest_source.length);
output.push(match[0]);
words.parse();
},
name: function() {
dstack.push(' ');
words.word();
},
/докт[ао]р,?\s*у\s*м[еи]ня\s*регулярк[аои]\s*г[ао]л[ао]вного\s*мо(ск|зг)а/i
+1
function getCartMiniViewDisplayString($cart_entries) {
$count = $cart_entries->getProductCount();
$suffix = "";
$remainder = $count % 10;
switch($remainder) {
case 1:
$suffix = " товар";
break;
case 2:
case 3:
case 4:
$suffix = " товара";
break;
case 5:
case 6:
case 7:
case 8:
case 9:
case 0:
$suffix = " товаров";
break;
}
return $count . $suffix;
}
Мой, переписывать с if в лень.