 |
Programming |
 |
29.01.2005, 01:45
|
#1
|
Профессор
Join Date: 01 2005
Location: Perm
Age: 46
Posts: 2,142
Rep Power: 0
|
Programming
Quote:
void m_SetYear ( CTime &Time )
{
switch ( Time.GetYear() )
{
case 2000: m_TagDate.Year = 0x00; break;
case 2001: m_TagDate.Year = 0x01; break;
case 2002: m_TagDate.Year = 0x02; break;
case 2003: m_TagDate.Year = 0x03; break;
case 2004: m_TagDate.Year = 0x04; break;
case 2005: m_TagDate.Year = 0x05; break;
case 2006: m_TagDate.Year = 0x06; break;
default : m_TagDate.Year = 0x00; break;
}
}
void m_SetMonth ( CTime &Time )
{
switch (Time.GetMonth() )
{
case 1: m_TagDate.Month = 0x01; break;
case 2: m_TagDate.Month = 0x02; break;
case 3: m_TagDate.Month = 0x03; break;
case 4: m_TagDate.Month = 0x04; break;
case 5: m_TagDate.Month = 0x05; break;
case 6: m_TagDate.Month = 0x06; break;
case 7: m_TagDate.Month = 0x07; break;
case 8: m_TagDate.Month = 0x08; break;
case 9: m_TagDate.Month = 0x09; break;
case 10: m_TagDate.Month = 0x0A; break;
case 11: m_TagDate.Month = 0x0B; break;
case 12: m_TagDate.Month = 0x0C; break;
}
}
void m_SetDay ( CTime &Time )
{
switch ( Time.GetDay() )
{
case 1: m_TagDate.Day = 0x01;break;
case 2: m_TagDate.Day = 0x02;break;
case 3: m_TagDate.Day = 0x03;break;
case 4: m_TagDate.Day = 0x04;break;
case 5: m_TagDate.Day = 0x05;break;
case 6: m_TagDate.Day = 0x06;break;
case 7: m_TagDate.Day = 0x07;break;
case 8: m_TagDate.Day = 0x08;break;
case 9: m_TagDate.Day = 0x09;break;
case 10: m_TagDate.Day = 0x0A;break;
case 11: m_TagDate.Day = 0x0B;break;
case 12: m_TagDate.Day = 0x0C;break;
case 13: m_TagDate.Day = 0x0D;break;
case 14: m_TagDate.Day = 0x0E;break;
case 15: m_TagDate.Day = 0x0F;break;
case 16: m_TagDate.Day = 0x10;break;
case 17: m_TagDate.Day = 0x11;break;
case 18: m_TagDate.Day = 0x12;break;
case 19: m_TagDate.Day = 0x13;break;
case 20: m_TagDate.Day = 0x14;break;
case 21: m_TagDate.Day = 0x15;break;
case 22: m_TagDate.Day = 0x16;break;
case 23: m_TagDate.Day = 0x17;break;
case 24: m_TagDate.Day = 0x18;break;
case 25: m_TagDate.Day = 0x19;break;
case 26: m_TagDate.Day = 0x1a;break;
case 27: m_TagDate.Day = 0x1b;break;
case 28: m_TagDate.Day = 0x1c;break;
case 29: m_TagDate.Day = 0x1d;break;
case 30: m_TagDate.Day = 0x1e;break;
case 31: m_TagDate.Day = 0x1f;break;
}
}
void m_SetHour ( CTime &Time)
{
switch ( Time.GetHour() )
{
case 0: m_TagTime.Hour = 0x00;break;
case 1: m_TagTime.Hour = 0x01;break;
case 2: m_TagTime.Hour = 0x02;break;
case 3: m_TagTime.Hour = 0x03;break;
case 4: m_TagTime.Hour = 0x04;break;
case 5: m_TagTime.Hour = 0x05;break;
case 6: m_TagTime.Hour = 0x06;break;
case 7: m_TagTime.Hour = 0x07;break;
case 8: m_TagTime.Hour = 0x08;break;
case 9: m_TagTime.Hour = 0x09;break;
case 10: m_TagTime.Hour = 0x0A;break;
case 11: m_TagTime.Hour = 0x0B;break;
case 12: m_TagTime.Hour = 0x0C;break;
case 13: m_TagTime.Hour = 0x0D;break;
case 14: m_TagTime.Hour = 0x0E;break;
case 15: m_TagTime.Hour = 0x0F;break;
case 16: m_TagTime.Hour = 0x10;break;
case 17: m_TagTime.Hour = 0x11;break;
case 18: m_TagTime.Hour = 0x12;break;
case 19: m_TagTime.Hour = 0x13;break;
case 20: m_TagTime.Hour = 0x14;break;
case 21: m_TagTime.Hour = 0x15;break;
case 22: m_TagTime.Hour = 0x16;break;
case 23: m_TagTime.Hour = 0x17;break;
case 24: m_TagTime.Hour = 0x18;break;
}
}
void m_SetMinute( CTime &Time )
{
switch ( Time.GetMinute() )
{
case 1: m_TagTime.Minute = 0x01;break;
case 2: m_TagTime.Minute = 0x02;break;
case 3: m_TagTime.Minute = 0x03;break;
case 4: m_TagTime.Minute = 0x04;break;
case 5: m_TagTime.Minute = 0x05;break;
case 6: m_TagTime.Minute = 0x06;break;
case 7: m_TagTime.Minute = 0x07;break;
case 8: m_TagTime.Minute = 0x08;break;
case 9: m_TagTime.Minute = 0x09;break;
case 10: m_TagTime.Minute = 0x0A;break;
case 11: m_TagTime.Minute = 0x0B;break;
case 12: m_TagTime.Minute = 0x0C;break;
case 13: m_TagTime.Minute = 0x0D;break;
case 14: m_TagTime.Minute = 0x0E;break;
case 15: m_TagTime.Minute = 0x0F;break;
case 16: m_TagTime.Minute = 0x10;break;
case 17: m_TagTime.Minute = 0x11;break;
case 18: m_TagTime.Minute = 0x12;break;
case 19: m_TagTime.Minute = 0x13;break;
case 20: m_TagTime.Minute = 0x14;break;
case 21: m_TagTime.Minute = 0x15;break;
case 22: m_TagTime.Minute = 0x16;break;
case 23: m_TagTime.Minute = 0x17;break;
case 24: m_TagTime.Minute = 0x18;break;
case 25: m_TagTime.Minute = 0x19;break;
case 26: m_TagTime.Minute = 0x1a;break;
case 27: m_TagTime.Minute = 0x1b;break;
case 28: m_TagTime.Minute = 0x1c;break;
case 29: m_TagTime.Minute = 0x1d;break;
case 30: m_TagTime.Minute = 0x1e;break;
case 31: m_TagTime.Minute = 0x1f;break;
case 32: m_TagTime.Minute = 0x20;break;
case 33: m_TagTime.Minute = 0x21;break;
case 34: m_TagTime.Minute = 0x22;break;
case 35: m_TagTime.Minute = 0x23;break;
case 36: m_TagTime.Minute = 0x24;break;
case 37: m_TagTime.Minute = 0x25;break;
case 38: m_TagTime.Minute = 0x26;break;
case 39: m_TagTime.Minute = 0x27;break;
case 40: m_TagTime.Minute = 0x28;break;
case 41: m_TagTime.Minute = 0x29;break;
case 42: m_TagTime.Minute = 0x2a;break;
case 43: m_TagTime.Minute = 0x2b;break;
case 44: m_TagTime.Minute = 0x2c;break;
case 45: m_TagTime.Minute = 0x2d;break;
case 46: m_TagTime.Minute = 0x2e;break;
case 47: m_TagTime.Minute = 0x2f;break;
case 48: m_TagTime.Minute = 0x30;break;
case 49: m_TagTime.Minute = 0x31;break;
case 50: m_TagTime.Minute = 0x32;break;
case 51: m_TagTime.Minute = 0x33;break;
case 52: m_TagTime.Minute = 0x34;break;
case 53: m_TagTime.Minute = 0x35;break;
case 54: m_TagTime.Minute = 0x36;break;
case 55: m_TagTime.Minute = 0x37;break;
case 56: m_TagTime.Minute = 0x38;break;
case 57: m_TagTime.Minute = 0x39;break;
case 58: m_TagTime.Minute = 0x3f;break;
case 59: m_TagTime.Minute = 0x3a;break;
case 60: m_TagTime.Minute = 0x3b;break;
}
}
void m_SetSecond( CTime &Time )
{
switch ( Time.GetSecond() )
{
case 1: m_TagTime.Second = 0x01;break;
case 2: m_TagTime.Second = 0x02;break;
case 3: m_TagTime.Second = 0x03;break;
case 4: m_TagTime.Second = 0x04;break;
case 5: m_TagTime.Second = 0x05;break;
case 6: m_TagTime.Second = 0x06;break;
case 7: m_TagTime.Second = 0x07;break;
case 8: m_TagTime.Second = 0x08;break;
case 9: m_TagTime.Second = 0x09;break;
case 10: m_TagTime.Second = 0x0A;break;
case 11: m_TagTime.Second = 0x0B;break;
case 12: m_TagTime.Second = 0x0C;break;
case 13: m_TagTime.Second = 0x0D;break;
case 14: m_TagTime.Second = 0x0E;break;
case 15: m_TagTime.Second = 0x0F;break;
case 16: m_TagTime.Second = 0x10;break;
case 17: m_TagTime.Second = 0x11;break;
case 18: m_TagTime.Second = 0x12;break;
case 19: m_TagTime.Second = 0x13;break;
case 20: m_TagTime.Second = 0x14;break;
case 21: m_TagTime.Second = 0x15;break;
case 22: m_TagTime.Second = 0x16;break;
case 23: m_TagTime.Second = 0x17;break;
case 24: m_TagTime.Second = 0x18;break;
case 25: m_TagTime.Second = 0x19;break;
case 26: m_TagTime.Second = 0x1a;break;
case 27: m_TagTime.Second = 0x1b;break;
case 28: m_TagTime.Second = 0x1c;break;
case 29: m_TagTime.Second = 0x1d;break;
case 30: m_TagTime.Second = 0x1e;break;
case 31: m_TagTime.Second = 0x1f;break;
case 32: m_TagTime.Second = 0x20;break;
case 33: m_TagTime.Second = 0x21;break;
case 34: m_TagTime.Second = 0x22;break;
case 35: m_TagTime.Second = 0x23;break;
case 36: m_TagTime.Second = 0x24;break;
case 37: m_TagTime.Second = 0x25;break;
case 38: m_TagTime.Second = 0x26;break;
case 39: m_TagTime.Second = 0x27;break;
case 40: m_TagTime.Second = 0x28;break;
case 41: m_TagTime.Second = 0x29;break;
case 42: m_TagTime.Second = 0x2a;break;
case 43: m_TagTime.Second = 0x2b;break;
case 44: m_TagTime.Second = 0x2c;break;
case 45: m_TagTime.Second = 0x2d;break;
case 46: m_TagTime.Second = 0x2e;break;
case 47: m_TagTime.Second = 0x2f;break;
case 48: m_TagTime.Second = 0x30;break;
case 49: m_TagTime.Second = 0x31;break;
case 50: m_TagTime.Second = 0x32;break;
case 51: m_TagTime.Second = 0x33;break;
case 52: m_TagTime.Second = 0x34;break;
case 53: m_TagTime.Second = 0x35;break;
case 54: m_TagTime.Second = 0x36;break;
case 55: m_TagTime.Second = 0x37;break;
case 56: m_TagTime.Second = 0x38;break;
case 57: m_TagTime.Second = 0x39;break;
case 58: m_TagTime.Second = 0x3f;break;
case 59: m_TagTime.Second = 0x3a;break;
case 60: m_TagTime.Second = 0x3b;break;
}
}
|
Этот программер не дурак. Серьезно не дурак !!!!!!!!!!!!!!!
Угадайте почему  ))))
Last edited by Nikita; 29.01.2005 at 02:04.
|
|
|
 |
29.01.2005, 01:54
|
#2
|
Профессор
Join Date: 01 2005
Location: Perm
Age: 46
Posts: 2,142
Rep Power: 0
|
Ludwig Von Anon sent in some code from the UI component of a large, multi-platform system he has the pleasure of working on. At first glance, the code didn't seem all too bad ...
procedure SelectFontIntoDC(Integer a) begin
declare fonthandle fh;
if (gRedraw is not false) then begin
fh = CreateFontIndirect(gDC);
SelectObject(gDC, fh);
DeleteObject(fh);
end;
end;
Seems fairly normal, right? Certainly nothing that meets our ... standards. Of course, when you factor in the name of the codefile (which ends in ".c") and the header included throughout the entire project ("pascal.h"), I think it becomes pretty apparent that we're entering Whiskey Tango Foxtrot country:
#define procedure void
#define then
#define is
#define not !=
#define begin {
#define end }
|
|
|
29.01.2005, 09:19
|
#3
|
the mochinger
Join Date: 02 2002
Location: Paranoid Android, @10:50
Age: 46
Posts: 1,894
Rep Power: 5
|
Quote:
Originally Posted by accemic26
Этот программер не дурак. Серьезно не дурак !!!!!!!!!!!!!!!
Угадайте почему  ))))
|
ne vdaalsja v podrobnosti, no some comments
1. durazkij kod 
2.
case 58: m_TagTime.Second = 0x3f;break;
case 58: m_TagTime.Minute = 0x3f;break;
eti dve strocki esli on napisal specialno, to ponjatno pochemu kod takoj idiotskij 
ne ponimaju reason punkta 2. dejstvitel'no. esli etim on ostavil v proge ljuk, to on ne durak a idiot ili lamer, uj tochno ne profi.
3. default : m_TagDate.Year = 0x00; break;
drugoe idiotstvo
vobshem accemik jan bazatri tenanq, heriq a qnes, wake up!
__________________
The flower that blooms in adversity is the most rare and beautiful of all.
|
|
|
 |
|
 |
29.01.2005, 09:22
|
#4
|
the mochinger
Join Date: 02 2002
Location: Paranoid Android, @10:50
Age: 46
Posts: 1,894
Rep Power: 5
|
Quote:
Originally Posted by accemic26
Ludwig Von Anon sent in some code from the UI component of a large, multi-platform system he has the pleasure of working on. At first glance, the code didn't seem all too bad ...
procedure SelectFontIntoDC(Integer a) begin
declare fonthandle fh;
if (gRedraw is not false) then begin
fh = CreateFontIndirect(gDC);
SelectObject(gDC, fh);
DeleteObject(fh);
end;
end;
Seems fairly normal, right? Certainly nothing that meets our ... standards. Of course, when you factor in the name of the codefile (which ends in ".c") and the header included throughout the entire project ("pascal.h"), I think it becomes pretty apparent that we're entering Whiskey Tango Foxtrot country:
#define procedure void
#define then
#define is
#define not !=
#define begin {
#define end }
|
xaxaxa. eto pervoe chto ja prodelal posle izuchenija c++. ndaa, ja byl boooolshim pascal fan-om  no ideja kanechno durazkaja
__________________
The flower that blooms in adversity is the most rare and beautiful of all.
|
|
|
 |
29.01.2005, 14:35
|
#5
|
Профессор
Join Date: 01 2005
Location: Perm
Age: 46
Posts: 2,142
Rep Power: 0
|
Hans Andersen:
Kak mojno eto optimizirovat ? !  i kak eto ti nichego podozritel`nogo ne zametil
i v kakix sluchayax etogo ne nado delat` ?
Last edited by Nikita; 29.01.2005 at 15:13.
|
|
|
29.01.2005, 16:04
|
#6
|
ЙЦУКЕН
Join Date: 07 2002
Location: 0x68,0x69,0x72, 0x69,0x6e,0x67, 0x20,0x6e,0x6f, 0x77
Age: 55
Posts: 3,118
Rep Power: 0
|
ндя ... опхожие циклы используются для развертывания циклов (искать по ключевым словам -- case c loop unroll hacket dictionary ну или что-то похожее)
а этот код - дурной. програмер написавший его 2 раз а подряд и не давший адекватного объяснения, почему он это сделал, достоин увольнения
|
|
|
29.01.2005, 16:17
|
#7
|
Профессор
Join Date: 01 2005
Location: Perm
Age: 46
Posts: 2,142
Rep Power: 0
|
НМ
Посмотри еще раз на этот код 
Как бы ты его оптимизировал ?
|
|
|
29.01.2005, 23:12
|
#8
|
Профессор
Join Date: 01 2005
Location: Perm
Age: 46
Posts: 2,142
Rep Power: 0
|
Hans Andersen
:=
|
|
|
30.01.2005, 04:38
|
#9
|
Академик
Join Date: 08 2002
Location: Yerevan, Armenia
Age: 53
Posts: 4,854
Rep Power: 5
|
I didn't get your point, sir. Optimize what ?
__________________
Женщин не надо понимать, их надо любить!
|
|
|
30.01.2005, 16:42
|
#10
|
Профессор
Join Date: 01 2005
Location: Perm
Age: 46
Posts: 2,142
Rep Power: 0
|
Первый код, это присваивание, но судя по все в ядре ОС присваивание не встречается и шутка не удалас.
Жаль
|
|
|
30.01.2005, 16:45
|
#11
|
Профессор
Join Date: 01 2005
Location: Perm
Age: 46
Posts: 2,142
Rep Power: 0
|
Первый код, это присваивание, но судя по всему в ядре ОС присваивание не встречается и шутка не удалас.
Жаль
|
|
|
30.01.2005, 18:48
|
#12
|
ЙЦУКЕН
Join Date: 07 2002
Location: 0x68,0x69,0x72, 0x69,0x6e,0x67, 0x20,0x6e,0x6f, 0x77
Age: 55
Posts: 3,118
Rep Power: 0
|
ндя. своебразные у вас путки, несмешные какие-то
|
|
|
30.01.2005, 19:51
|
#13
|
Профессор
Join Date: 01 2005
Location: Perm
Age: 46
Posts: 2,142
Rep Power: 0
|
Жаль
В другом форуме этот код завоевал огромную популярность ...
Видно американцы тупые всетаки ...
|
|
|
30.01.2005, 20:04
|
#14
|
Академик
Join Date: 08 2002
Location: Yerevan, Armenia
Age: 53
Posts: 4,854
Rep Power: 5
|
Vidimo, ya "dub kak derevo", poka ne vrubilsya...
__________________
Женщин не надо понимать, их надо любить!
|
|
|
30.01.2005, 20:40
|
#15
|
the mochinger
Join Date: 02 2002
Location: Paranoid Android, @10:50
Age: 46
Posts: 1,894
Rep Power: 5
|
Quote:
Originally Posted by accemic26
Первый код, это присваивание, но судя по все в ядре ОС присваивание не встречается и шутка не удалас.
Жаль 
|
chto? anu perevedi
__________________
The flower that blooms in adversity is the most rare and beautiful of all.
|
|
|
All times are GMT. The time now is 00:48. |
|
|