- 1
if(preg_match("/\.[gjpi][ipnc][fgo]/i", $_SERVER['REQUEST_URI'])) exit;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+157.2
if(preg_match("/\.[gjpi][ipnc][fgo]/i", $_SERVER['REQUEST_URI'])) exit;
+8.1
// файлToolStripMenuItem
//
this->файлToolStripMenuItem->Name = L"файлToolStripMenuItem";
this->файлToolStripMenuItem->Size = System::Drawing::Size(54, 22);
this->файлToolStripMenuItem->Text = L"Файл";
this->файлToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::файлToolStripMenuItem_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 260);
this->Controls->Add(this->button1);
this->Controls->Add(this->menuStrip1);
this->MainMenuStrip = this->menuStrip1;
this->Name = L"Form1";
this->Text = L"Form1";
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void меню1ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void файлToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void выходToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
}
};
MS VS 2005 - MS VS 2008 это спокойно компилирует, да ещё и сама код генерирует, когда на формочке рисуешь русское меню.
Этот компилятор определённо соответсвует стандарту С++.
+12.1
class TIntArray
{
char buf[10000];
int operator[](int Index);
};
...
void main()
{
TIntArray a;
...
memset(&a[1],0.0f,sizeof(TIntArray));
...
};
Меня этот кот довёл до слёз...
+13.1
#define REGISTER_PACKET(cls, type)\
__declspec(selectany) PacketType cls::s_type = CPacketFactory::RegisterPacket(type, cls::CreateNew); \
__pragma(comment(linker, "/include:?s_type@##cls##@@2W4PacketType@@C"))
Очень правильный код... Делать можно только так.
+136
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <math.h>
#include <stdlib.h>
struct thread_arg
{
int a;
int b;
int c;
double d;
};
void *ret_x1(void *arg)
{
struct thread_arg targ = *(struct thread_arg *)arg;
double x1;
x1 = (-targ.b + sqrt(targ.d)) / (2*targ.a);
fprintf(stderr, "x1 = %f\n", x1);
return NULL;
}
void *ret_x2(void *arg)
{
struct thread_arg targ = *(struct thread_arg*)arg;
double x2;
x2 = (-targ.b - sqrt(targ.d)) / (2*targ.a);
fprintf(stderr, "x2 = %f\n", x2);
return NULL;
}
int main(void)
{
pthread_t thread1, thread2;
struct thread_arg args;
fprintf(stderr, "Enter a, b and c\n");
scanf("%d %d %d", &args.a, &args.b, &args.c);
args.d = args.b*args.b - 4*args.a*args.c;
if(args.d < 0)
{
fprintf(stderr,"There is no roots\n");
return 0;
}
else
{
if(pthread_create(&thread1, NULL, &ret_x1, &args) != 0)
{
fprintf(stderr, "Error1\n");
return 1;
}
if(pthread_create(&thread2, NULL, &ret_x2, &args) != 0)
{
fprintf(stderr, "Error2\n");
return 1;
}
pthread_join(thread1, NULL);
pthread_join(thread2, NULL);
}
return 0;
}
Многопоточное решение квадратного уравнения...
+155
$cnt_ = count($array_objects['rate']);
for($i=0; $i<$cnt_; $i++) {
//...
}
$DB->query('REPAIR TABLE `' . $rates_table . '` QUICK;');
Кусок скрипта для импорта данных из XML...
+76.3
try {
....
} catch (Exception ex) {
if (ex != null) {
try {
ex.printStackTrace();
} catch(Exception ex1) {
....
}
}
}
+137.7
$q = mysql_query ("SELECT * FROM theodorakisdiscographygre");
$num_rows = mysql_num_rows($q);
for ($m=0; $m<$num_rows; $m++)
{
$q = mysql_query ("SELECT * FROM theodorakisdiscographygre");
for ($c=0; $c<($num_rows-$m); $c++)
{
$f = mysql_fetch_array($q);
}
echo $f["content"];
}
сортировка
+152.3
if($_POST[tel]=='')
{
print "<script language=\"javascript\">\n";
print "showmsg('tel');\n";
print "</script>\n";
}
if($_POST[name]=='')
{
print "<script language=\"javascript\">\n";
print "showmsg('name');\n";
print "</script>\n";
}
if(($_POST[name]!='')&&($_POST[tel]!=''))
{
print "<meta http-equiv=\"Refresh\" content=\"0;URL=send.php?name=$_POST[name]&tel=$_POST[tel]\" />\n";
die();
}
Разбираю один движок инет-магазина. Первое что я понял - автор идиот. Второе - он совершенно ничего не знает об elseif'ах
+142
function roundPagesCount($int)
{
if ($int / 1000000000 > 1) {
return round($int/1000000000). ' млрд';
}
if ($int / 1000000 > 1) {
return round($int/1000000). ' млн';
}
if ($int / 1000 > 1) {
return round($int/1000). ' тыс';
}
}
без слов))))