TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: what is the most stupid line of code you saw?

8 pointsby _yieldsover 12 years ago
Believe it or not, i just saw this:<p>`if (true === true)`<p>^^ Old PHP site.

13 comments

fzfzqfzover 12 years ago
Old php site from year 2000.<p>Each line of HTML is generated like that :<p>$html.='&#60;html&#62;';<p>$html.='&#60;body&#62;';<p>$html.='The content';<p>$html.='&#60;/body&#62;';<p>$html.='&#60;/html&#62;';<p>The dev used this in every file, each file contain thousands of lines like that. Worst project i have ever seen, and i must work alone on it. FML.
评论 #5250964 未加载
pyfapover 12 years ago
Saw the title. Immediately thought of something I saw today at work. Not too different from yours. 'if ('True' == 'True')'. I should note that this is javascript generated by a template file.
tdubbedover 12 years ago
I've actually used 1==2 and 1==1 to basically comment sections out or create an infinite while loop. Only really useful in C-style languages<p>Dumb mistakes I've seen include commented out error checking because of a reversed greater than sign and a SQL query that deletes the whole table before rebuilding the entire thing every day
eb0laover 12 years ago
I remember in college, someone left his/hers C assignment source code in the lab (laptops were a luxury in that time).<p>The code was really awful, and that part hurt my eyes:<p>/* commented out code. &#60;--- Yep. That was the actual comment.<p><pre><code> and here was the code seriously */ </code></pre> At least (s)he knew what a block comment was.
DanielNover 12 years ago
My personal favorite:<p><pre><code> $array = array('z'=&#62;12, 'o'=&#62;43, 't'=&#62;32, 'th'=&#62;85, 'f'=&#62;91, 'fi'=&#62;42); </code></pre> Take a minute look at that and tell me what the keys stand for. When you figure it out you'll realize why this is the worst piece of code you've ever seen.
whalesaladover 12 years ago
I do that sometimes during debugging. It stands out and I know to change it later. If 1 == 0, etc...
krappover 12 years ago
<p><pre><code> &#60;?php /* Start the Loop */ ?&#62; </code></pre> Followed by more php.
评论 #5249309 未加载
chrisdevereuxover 12 years ago
This might make some sense if it wasn't for the comment at the end...<p><pre><code> enum BankID { ONE = 1, TWO = 2, THREE = 3, FOUR = 4 // add more if needed };</code></pre>
AbhishekBiswalabout 12 years ago
My Teacher used this code to explain conditions in class :<p>if( 1 == 1 ) cout &#60;&#60; "it's true" &#60;&#60; endl; else cout &#60;&#60; "false" &#60;&#60; endl;<p>Haha, 1==1
orangethirtyover 12 years ago
Mine. From a long time ago, in a Galaxy far, far away.<p><pre><code> #python SQL injection paradise. sql = 'SELECT * FROM %s' % table</code></pre>
kschuaover 12 years ago
Java code<p>if (obj instanceof java.lang.Object)
评论 #5254588 未加载
评论 #5249621 未加载
codeonfireover 12 years ago
saw this a while back:<p>if (failed) { return SUCCESS; }
graycatabout 12 years ago
i = j+++++k