pouët.net

Go to bottom

the unnecessary dumbhead-coding thread

category: general [glöplog]
lemme start like this:

value += -1;

or:

for ( i=0; i<1; i++)
{
return 0;
}

( this thread is intended to make you imagine how dumb (new) ( maybe 5-years-old &| (AndOr) microsoft- ) coders could get/be/are ! )
for (i=0;i>LOL;i++) {
echo "php is a LOL by itself."
}
Quote:
"We need NOPs.
Lots of NOPs!"
added on the 2009-02-15 02:54:17 by raer raer
one mo...

c64 ( f.e. ) is not dumbhead-coding...
...NOPs are really necessary there ! :) and they only eat up 1cycle anyway !
without NOPs you would have had BASIC-only_Games forever on c64 i guess ;)
wat
added on the 2009-02-15 04:09:42 by Gargaj Gargaj
get a life c0c00n...
or team up with optimus
a guy at our company asked me to look over his code and give him a hint as to why it didn't perform as expected.
when i sat down next to him and could not set a breakpoint in the code bit in question, i recompiled the whole project just to find out that the compiler generated "dead code detected" warnings all over the place.
when i asked him about this he told me that those were just warnings which get tolerated by the compiler and therefore he didn't care they were there... dumbass
added on the 2009-02-15 11:35:50 by hcdlt hcdlt
Yesterday I tried to open a screen in freebasic and I didn't remember the command in fbgfx lib. I found out somewhere and wrote it and for an hour I was begging why the fuck it didn't open a screen. I just mistyped my screen_width variable to screen_widht and couldn't see that for an hour :)
added on the 2009-02-15 11:53:45 by Optimus Optimus
also (i read that more often than you might think):

void some_function(void)
{
int b;
...
...
...
if(b == 0)
{
...
}
}

let alone the forgotten initialization issue, the best justification the responsible coder gave to me was that he "checked in debug and that it got initialized properly anyway", so he figured he didn't have to do anything about it.
added on the 2009-02-15 12:01:10 by hcdlt hcdlt
More than code, I'm afraid with logic. A guy at a company I used to work at, once made a form for a db/accounting application.

First, he put the Euro/Peseta conversion (it was that time) in a variable (just in case it changed? ;-) )... but that was not the worst part, only the obvious.

A few months later, the visual design of the program had to be changed (change in colors and stuff), and suddenly all forms made by this guy stopped working.

Upon further inspection of the code, he was checking "read only" component status using the background color (this was Delphi VCL btw).

Go figure :)
added on the 2009-02-15 12:04:38 by Jcl Jcl
Quote:
Yesterday I tried to open a screen in freebasic and I didn't remember the command in fbgfx lib. I found out somewhere and wrote it and for an hour I was begging why the fuck it didn't open a screen. I just mistyped my screen_width variable to screen_widht and couldn't see that for an hour :)

that's why coding with -lang deprecated is so bad for you.
if(a=b)
yeah,stijn...if it looped 4.294.967.295 times, it´ll get 0 again !
so booze forever @BP
cOcOOn:

In C integer overflow of signed ints is undefined. The compiler is free to remove the entire loop-control and replace it with a infinite loop.

Not that it makes a difference though.
added on the 2009-02-15 12:58:14 by torus torus
thanx for info tho...me dumbhead-coder, haha...really didn´t know this.
This pearl is from moebius, very cool 256B intro.

Code:00000031 D944F4 fld dword [si-0xc] 00000034 D9FB fsincos 00000036 D9E8 fld1 00000038 D87CF4 fdivr dword [si-0xc] 0000003B D9FB fsincos
added on the 2009-02-15 13:25:42 by Pirx Pirx
please explain
fld1
fdivr dword [si-0xc]

=>

[si-0xc]/1

=>

[si-0xc]

So without having looked at the full source code I guess he was padding his executable in a less-obvious way.
added on the 2009-02-15 14:10:05 by mic mic
it's fdivr, not fdiv. that's definitely no padding :)
added on the 2009-02-15 16:09:36 by ryg ryg
Quote:
and they only eat up 1cycle anyway

i can tell that you are drunken, even pc coders know that there are no 1 cycle instructions on the 6510 :)
added on the 2009-02-15 16:50:08 by blala blala
ryg, if it was fdiv, I wouldn't post it here. Look also at original commented source:
Code:fld dword [si-12] ; s fsincos ; sin(s) cos(s) fld1 ; 1 s sin(s) cos(s) fdivr dword [si-12] fsincos ; sin(s/2) cos(s/2) cos(s) sin(s)
and think about fdivr/fsincos cycles. Just an example that even great coder can make some nonsense mess.
added on the 2009-02-15 17:11:14 by Pirx Pirx
blala, i'm a pc coder, and i never understood why nops exist. maybe now is a great moment to elaborate?
added on the 2009-02-15 17:18:40 by skrebbel skrebbel
Skrebbel : as an Outline org, you MUST know what Nop were used for ;)
added on the 2009-02-15 17:20:38 by keops keops
sorry :-( :-(
added on the 2009-02-15 17:22:59 by skrebbel skrebbel

login

Go to top