Jen*_*and 1463
我对此特别内疚,在我的大部分项目中嵌入了非建设性的评论,代码诗和小笑话(虽然我通常有足够的意识在发布代码之前删除任何直接令人反感的内容).这是我特别喜欢的一个,远远落在一个设计不佳的"上帝对象"上:
/**
* For the brave souls who get this far: You are the chosen ones,
* the valiant knights of programming who toil away, without rest,
* fixing our most awful code. To you, true saviors, kings of men,
* I say this: never gonna give you up, never gonna let you down,
* never gonna run around and desert you. Never gonna make you cry,
* never gonna say goodbye. Never gonna tell a lie and hurt you.
*/
Run Code Online (Sandbox Code Playgroud)
对不起!!!!我忍不住自己......!
而另一位,这我承认我还没有真正释放到野外,即使我很动心,我不太直观的一个类可以这样做:
//
// Dear maintainer:
//
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
//
// total_hours_wasted_here = 42
//
Run Code Online (Sandbox Code Playgroud)
スーパ*_*ミコン 1055
Exception up = new Exception("Something is really wrong.");
throw up; //ha ha
Run Code Online (Sandbox Code Playgroud)
joh*_*hnc 1052
//When I wrote this, only God and I understood what I was doing
//Now, God only knows
Run Code Online (Sandbox Code Playgroud)
Tuo*_*ski 1048
stop(); // Hammertime!
Run Code Online (Sandbox Code Playgroud)
小智 1031
这似乎阻止了笨蛋弄乱我的代码......
// Autogenerated, do not edit. All changes will be undone.
Run Code Online (Sandbox Code Playgroud)
Ser*_*lov 946
// sometimes I believe compiler ignores all my comments
Run Code Online (Sandbox Code Playgroud)
sha*_*kin 930
// I dedicate all this code, all my work, to my wife, Darlene, who will
// have to support me and our three children and the dog once it gets
// released into the public.
Run Code Online (Sandbox Code Playgroud)
Tom*_*ter 911
Run Code Online (Sandbox Code Playgroud)//Code sanitized to protect the foolish. using System; using System.Collections.Generic; using System.Text; using System.Reflection; using System.Web.UI; namespace Mobile.Web.Control { /// <summary> /// Class used to work around Richard being a fucking idiot /// </summary> /// <remarks> /// The point of this is to work around his poor design so that paging will /// work on a mobile control. The main problem is the BindCompany() method, /// which he hoped would be able to do everything. I hope he dies. /// </remarks> public abstract class RichardIsAFuckingIdiotControl : MobileBaseControl, ICompanyProfileControl { protected abstract Pager Pager { get; } public void BindCompany(int companyId) { } public RichardIsAFuckingIdiotControl() { MakeSureNobodyAccidentallyGetsBittenByRichardsStupidity(); } private void MakeSureNobodyAccidentallyGetsBittenByRichardsStupidity() { // Make sure nobody is actually using that fucking bindcompany method MethodInfo m = this.GetType().GetMethod("BindCompany", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (m != null) { throw new RichardIsAFuckingIdiotException("No!! Don't use the fucking BindCompany method!!!"); } // P.S. this method is a joke ... the rest of the class is fucking serious } /// <summary> /// This returns true if this control is supposed to be doing anything /// at all for this request. Richard thought it was a good idea to load /// the entire website during every request and have things turn themselves /// off. He also thought bandanas and aviator sunglasses were "fuckin' /// gnarly, dude." /// </summary> protected bool IsThisTheRightPageImNotSureBecauseRichardIsDumb() { return Request.QueryString["Section"] == this.MenuItemKey; } protected override void OnLoad(EventArgs e) { if (IsThisTheRightPageImNotSureBecauseRichardIsDumb()) { Page.LoadComplete += new EventHandler(Page_LoadComplete); Pager.RowCount = GetRowCountBecauseRichardIsDumb(); } base.OnLoad(e); } protected abstract int GetRowCountBecauseRichardIsDumb(); protected abstract void BindDataBecauseRichardIsDumb(); void Page_LoadComplete(object sender, EventArgs e) { BindDataBecauseRichardIsDumb(); } // the rest of his reduh-ndant interface members public abstract string MenuItemName { get; set; } public abstract string MenuItemKey { get; set; } public abstract bool IsCapable(CapabilityCheck checker, int companyId); public abstract bool ShowInMenu { get; } public virtual Control CreateHeaderControl() { return null; } } }
更新: 该代码的原始作者已经将自己打败了,所以我必须在到期时给予信任.Dan McKinley在我开始后不久就离开了我所在的公司,他更多地谈论了代码,解释了一些背景以及一些"理查德"所写的"WTF".
Roh*_*hit 826
// somedev1 - 6/7/02 Adding temporary tracking of Login screen
// somedev2 - 5/22/07 Temporary my ass
Run Code Online (Sandbox Code Playgroud)
Dan*_*ian 727
// drunk, fix later
Run Code Online (Sandbox Code Playgroud)
希望我在开玩笑.并且知道编写代码的开发人员,我认为他的字面意思.
Jas*_*ram 719
// Magic. Do not touch.
Run Code Online (Sandbox Code Playgroud)
小智 701
#define TRUE FALSE
//Happy debugging suckers
Gre*_*g D 640
// I'm sorry.
Run Code Online (Sandbox Code Playgroud)
小智 636
return 1; # returns 1
Run Code Online (Sandbox Code Playgroud)
Dra*_*mon 591
/* This is O(scary), but seems quick enough in practice. */
Run Code Online (Sandbox Code Playgroud)
接下来是四个嵌套的for循环
Lan*_*ell 589
// Replaces with spaces the braces in cases where braces in places cause stasis
$str = str_replace(array("\{","\}")," ",$str);
Run Code Online (Sandbox Code Playgroud)
rle*_*lut 542
它说明了我们的专业,当被问及"最佳评论"时,我们都会回答我们能找到的最糟糕的评论......
Sea*_*ean 525
long john; // silver
Run Code Online (Sandbox Code Playgroud)
Ran*_*yaa 508
Catch (Exception e) {
//who cares?
}
Run Code Online (Sandbox Code Playgroud)
mar*_*nus 496
/**
* Always returns true.
*/
public boolean isAvailable() {
return false;
}
Run Code Online (Sandbox Code Playgroud)
永远不要依赖评论......
Pop*_*ein 457
/*
* You may think you know what the following code does.
* But you dont. Trust me.
* Fiddle with it, and youll spend many a sleepless
* night cursing the moment you thought youd be clever
* enough to "optimize" the code below.
* Now close this file and go play with something else.
*/
Run Code Online (Sandbox Code Playgroud)
ged*_*van 429
try {
} finally { // should never happen
}
Run Code Online (Sandbox Code Playgroud)
小智 412
来自:https://github.com/zepouet/Xee-xCode-4.5/blob/master/XeePhotoshopLoader.m#L108
// At this point, I'd like to take a moment to speak to you about the Adobe PSD
// format. PSD is not a good format. PSD is not even a bad format. Calling it
// such would be an insult to other bad formats, such as PCX or JPEG. No, PSD
// is an abysmal format. Having worked on this code for several weeks now, my
// hate for PSD has grown to a raging fire that burns with the fierce passion
// of a million suns.
//
// If there are two different ways of doing something, PSD will do both, in
// different places. It will then make up three more ways no sane human would
// think of, and do those too. PSD makes inconsistency an art form. Why, for
// instance, did it suddenly decide that *these* particular chunks should be
// aligned to four bytes, and that this alignement should *not* be included in
// the size? Other chunks in other places are either unaligned, or aligned with
// the alignment included in the size. Here, though, it is not included. Either
// one of these three behaviours would be fine. A sane format would pick one.
// PSD, of course, uses all three, and more.
//
// Trying to get data out of a PSD file is like trying to find something in the
// attic of your eccentric old uncle who died in a freak freshwater shark
// attack on his 58th birthday. That last detail may not be important for the
// purposes of the simile, but at this point I am spending a lot of time
// imagining amusing fates for the people responsible for this Rube Goldberg of
// a file format.
//
// Earlier, I tried to get a hold of the latest specs for the PSD file format.
// To do this, I had to apply to them for permission to apply to them to have
// them consider sending me this sacred tome. This would have involved faxing
// them a copy of some document or other, probably signed in blood. I can only
// imagine that they make this process so difficult because they are intensely
// ashamed of having created this abomination. I was naturally not gullible
// enough to go through with this procedure, but if I had done so, I would have
// printed out every single page of the spec, and set them all on fire. Were it
// within my power, I would gather every single copy of those specs, and launch
// them on a spaceship directly into the sun.
//
// PSD is not my favourite file format.
Run Code Online (Sandbox Code Playgroud)
Mik*_*ike 387
const int TEN=10; // As if the value of 10 will fluctuate...
Run Code Online (Sandbox Code Playgroud)
小智 364
#Christmas tree initializer
toConnect = []
toRead = [ ]
toWrite = [ ]
primes = [ ]
responses = {}
remaining = {}
Run Code Online (Sandbox Code Playgroud)
Gor*_*ran 362
大约30页xslt的中间
<!-- Here be dragons -->
Run Code Online (Sandbox Code Playgroud)
Jul*_*ano 354
long long ago; /* in a galaxy far far away */
Run Code Online (Sandbox Code Playgroud)
Ste*_* B. 353
在完全没有注释的2000行方法中
{
{
while (.. ){
if (..){
}
for (.. ){
}
.... (just putting in the control flow here, imagine another few hundred ifs)
if(..) {
if(..) {
if(..) {
...
(another few hundred brackets)
}
}
} //endif
Run Code Online (Sandbox Code Playgroud)
(我实际上有一天只是为了看看它有多糟糕而把所有括号都弄出来了,并且,没有格式化,得到了这个:
{{{{}}{}{}{}{}}{{}{{}{}{}{}{}{}{{}{}}{}{}{{}{}{}{}{}{}{}{}{}{}{}{{}}}{{}{{}}{{{}}}{{}{}{}{}{}{}{}{{}}{}{{{}}{}{{}{}}{{{}}{}{}{}{}}{{}}}{}{{}{}{}{{}{{}}{}}{{}}}{{}}{{}}{{}}{}{{}}{{}}{{}}{{}{}{}}{}{}{{{}}{{}}}{}{}{}{}}{{{}{{}{}{}{{}{}{}{}{}{}}{}}{{}}{{}{}}}{{}}{{}}}{{}}{{}}{}{}{}{}{{}}{{}{}{}{}}}}{}{}}{{}{{{}{}{}{}}}}{{}{{{}}}}{{}{{{}{{}}{}{{}}{}{{}{}}{{}}{}{{}}}{{}}}}{{}{}{}{}{}{{{} {{{{}}{}{}{}{}}{{}{{}{}{}{}{}{}{{}{}}{}{}{{}{}{}{}{}{}{}{}{}{}{}{{}}}{{}{{}}{{{}}}{{}{}{}{}{}{}{}{{}}{}{{{}}{}{{}{}}{{{}}{}{}{}{}}{{}}}{}{{}{}{}{{}{{}}{}}{{}}}{{}}{{}}{{}}{}{{}}{{}}{{}}{{}{}{}}{}{}{{{}}{{}}}{}{}{}{}}{{{}{{}{}{}{{}{}{}{}{}{}}{}}{{}}{{}{}}}{{}}{{}}}{{}}{{}}{}{}{}{}{{}}{{}{}{}{}}}}{}{}}{{}{{{}{}{}{}}}}{{}{{{}}}}{{}{{{}{{}}{}{{}}{}{{}{}}{{}}{}{{}}}{{}}}}{{}{}{}{}{}{{{}{}{{}}{}}}{}}{{}}{{}{}}{{}{{}{{}}}}{{{}{{{}}}}}{{{{{}}}}}{}{}{}{{{{}}}{}{}}{{}{{}}}}{}{{}}{}}}{}}{{}}{{}{}}{{}{{}{{}}}}{{{}{{{}}}}}{{{{{}}}}}{}{}{}{{{{}}}{}{}}{{}{{}}}}
Run Code Online (Sandbox Code Playgroud)
endif出现在800号线附近)
Kev*_*Dog 352
//This code sucks, you know it and I know it.
//Move on and call me an idiot later.
Run Code Online (Sandbox Code Playgroud)
Joh*_*ran 324
// If this comment is removed the program will blow up
Run Code Online (Sandbox Code Playgroud)
Mac*_*cke 296
double penetration; // ouch
Run Code Online (Sandbox Code Playgroud)
小智 291
/////////////////////////////////////// this is a well commented line
Run Code Online (Sandbox Code Playgroud)
Chr*_*son 269
// I don't know why I need this, but it stops the people being upside-down
x = -x;
Run Code Online (Sandbox Code Playgroud)
Roa*_*alt 254
其中最经典的一个是Pierre de Fermat关于他众所周知的"最后定理"的评论:"这个页面的边缘有点太小而无法记下证明".
在证据被发现之前花了350多年......
(根据维基百科这是原文:)
Cubos autem in duos cubos,aut quadratoquadratum in duos quadratoquadratos,et generaliter nullam in infinitum ultra quadratum potestatem in duos eiusdem nominis fas est dividere cuius rei demonsti mirabilem sane detexi.Hanc marginis exiguitas非caperet.
...并翻译成英文:
(不可能将立方体分成两个立方体,或者将第四个功率分成两个四分之一的功率,或者一般来说,任何高于第二功率的功率都分成两个相似的功率.我发现了一个真正奇妙的证明,这个边缘是太狭隘了.)
aba*_*rax 254
// I am not sure if we need this, but too scared to delete.
Run Code Online (Sandbox Code Playgroud)
Jos*_*all 233
从Java 1.2 SwingUtilities:
doRun.run(); // ... "a doo run run".
Run Code Online (Sandbox Code Playgroud)
Chr*_*oyd 230
# To understand recursion, see the bottom of this file
Run Code Online (Sandbox Code Playgroud)
在文件的底部:
# To understand recursion, see the top of this file
Run Code Online (Sandbox Code Playgroud)
pae*_*bal 223
在我们的团队中,这个是生产代码中的微观管理效果的生动证明:
// I am not responsible of this code.
// They made me write it, against my will.
Run Code Online (Sandbox Code Playgroud)
......接下来是不太理想的代码,由我们敬爱的技术总监构思,他非常喜欢将代码和编码指南强制转化为开发人员的喉咙(*).
当然,当项目负责人搜索错误的原因,并发现它在"不太理想的代码"里面时,他不是很有趣......
(*)我是,当然,提全能王VB ...如果你想评估的权力全部规模强大VB王,你可以阅读下面的SO职位:什么是奇怪的编码标准规则你被迫跟随?...
Aid*_*dos 219
我经历了一个睡眠不足的编码运行,并开始只写出来自Fight Club引用的评论.
几年后我仍在搜索代码,我发现一条让我发笑的评论.他们中的大多数只是随意的想法 然而,我确实保持我的评论线条比例相当不错!
// This shouldn't happen. The only way this can happen is if the
// <code>JFileChooser</code> has returned a <code>File</code> that doesn't exist
// on the system. If this happens we can't recover, and there is more than likely
// a rip in the space time continuum that the user is too distracted by to notice
// anything else.
Run Code Online (Sandbox Code Playgroud)
/**
* This method leverages collective synergy to drive "outside of the box"
* thinking and formulate key objectives into a win-win game plan with a
* quality-driven approach that focuses on empowering key players to drive-up
* their core competencies and increase expectations with an all-around
* initiative to drive down the bottom-line. I really wanted to work the word
* "mandrolic" in there, but that word always makes me want to punch myself in
* the face.
*/
private void updateFileCountLabel() {
Run Code Online (Sandbox Code Playgroud)
Dav*_*wer 217
很多年前(大约1994年),我正在为一家大型跨国软件公司开发Oracle PRO*C应用程序,你会听说过.我正在开发的应用程序是一个庞大的Oracle应用程序,他们有一个实用程序,可以在一夜之间整理数据并进行各种聚合计算.每当需要做任何批处理工作时,它都被推到了这个工具中,你可以想象它变成了一个绝对的怪物.同样值得注意的是,它对这样一个庞大的计划所做的评论很少.
它所做的为数不多的评论之一仍然是我见过的纯粹WTF的最好的评论......我试图找到一个长达数百行的函数中的错误,正好在它的中间是唯一的评论功能:
/* I did this the other way */
Run Code Online (Sandbox Code Playgroud)
直到今天,它仍然是我见过的最好的评论.
dan*_*els 216
/* Please work */
Run Code Online (Sandbox Code Playgroud)
Mia*_*rke 212
//Dear future me. Please forgive me.
//I can't even begin to express how sorry I am.
Run Code Online (Sandbox Code Playgroud)
我今天刚刚发现了这个:
//private instance variable for storing age
public static int age;
Run Code Online (Sandbox Code Playgroud)
180*_*ION 207
/* You are not meant to understand this */
Run Code Online (Sandbox Code Playgroud)
Stu*_*ule 192
//I am not sure why this works but it fixes the problem.
Run Code Online (Sandbox Code Playgroud)
这是在一组代码之前,在技术上确实解决了它本来应该解决的问题,但打破了其他3件事....
Nei*_*ner 186
// no comments for you
// it was hard to write
// so it should be hard to read
Run Code Online (Sandbox Code Playgroud)
Sam*_*ain 178
/* Halley's comment */
Run Code Online (Sandbox Code Playgroud)
jum*_*kie 178
options.BatchSize = 300; //Madness? THIS IS SPARTA!
Run Code Online (Sandbox Code Playgroud)
pro*_*dad 172
我们的DBA在第三方编写的3000行存储过程中发现了这一点.
/* IF DOLPHINS ARE SO SMART, HOW COME THEY LIVE IN IGLOOS? */
Run Code Online (Sandbox Code Playgroud)
Gia*_*rlo 171
在js代码:
// hack for ie browser (assuming that ie is a browser)
Run Code Online (Sandbox Code Playgroud)
Kno*_*och 155
/* Emits a 7-Hz tone for 10 seconds.
True story: 7 Hz is the resonant frequency of a
chicken's skull cavity. This was determined
empirically in Australia, where a new factory
generating 7-Hz tones was located too close to a
chicken ranch: When the factory started up, all the
chickens died.
Your PC may not be able to emit a 7-Hz tone. */
main()
{
sound(7);
delay(10000);
nosound();
}
Run Code Online (Sandbox Code Playgroud)
(Turbo C 2.0版参考指南中的声音功能)
Bob*_*ack 147
尝试在谷歌代码搜索中输入您最喜欢的亵渎语言,它可以消除许多沉闷的时间.我最喜欢的一些例子:
/* These magic numbers are fucking stupid. */
/* Dear free software world, do you NOW see we are fucking
things up?! This is insane! */
/* We will NOT put a fucking timestamp in the header here. Every
time you put it back, I will come in and take it out again. */
# However, this only works if there are MULTIPLE checkboxes!
# The fucking JS DOM *changes* based on one or multiple boxes!?!?!
# Damn damn damn I hate the JavaScript DOM so damn much!!!!!!
/* TODO: this is obviously not right ... this whole fucking module
sucks anyway */
/* FIXME: please god, when will the hurting stop? Thus function is so
fucking broken it's not even funny. */
Run Code Online (Sandbox Code Playgroud)
和我个人的最爱
# code below replaces code above - any problems?
# yeah, it doesn't fucking work.
Run Code Online (Sandbox Code Playgroud)
Bri*_*per 146
在初始化链表时:
last = first; /* Biblical reference */
Run Code Online (Sandbox Code Playgroud)
扼杀和搞笑.
lli*_*lib 145
有人抱怨"最好的"评论提出了最糟糕的评论.恕我直言,他们是有趣,因此"更好",但这里是我所见过的最诚实的境界评论阅读:
/*
Major subtleties ahead: Most hash schemes depend on having a "good" hash
function, in the sense of simulating randomness. Python doesn't: its most
important hash functions (for strings and ints) are very regular in common
cases:
>>> map(hash, (0, 1, 2, 3))
[0, 1, 2, 3]
>>> map(hash, ("namea", "nameb", "namec", "named"))
[-1658398457, -1658398460, -1658398459, -1658398462]
>>>
This isn't necessarily bad! To the contrary, in a table of size 2**i, taking
the low-order i bits as the initial table index is extremely fast, and there
are no collisions at all for dicts indexed by a contiguous range of ints.
The same is approximately true when keys are "consecutive" strings. So this
gives better-than-random behavior in common cases, and that's very desirable.
OTOH, when collisions occur, the tendency to fill contiguous slices of the
hash table makes a good collision resolution strategy crucial. Taking only
the last i bits of the hash code is also vulnerable: for example, consider
[i << 16 for i in range(20000)] as a set of keys. Since ints are their own
hash codes, and this fits in a dict of size 2**15, the last 15 bits of every
hash code are all 0: they *all* map to the same table index.
But catering to unusual cases should not slow the usual ones, so we just take
the last i bits anyway. It's up to collision resolution to do the rest. If
we *usually* find the key we're looking for on the first try (and, it turns
out, we usually do -- the table load factor is kept under 2/3, so the odds
are solidly in our favor), then it makes best sense to keep the initial index
computation dirt cheap.
The first half of collision resolution is to visit table indices via this
recurrence:
j = ((5*j) + 1) mod 2**i
For any initial j in range(2**i), repeating that 2**i times generates each
int in range(2**i) exactly once (see any text on random-number generation for
proof). By itself, this doesn't help much: like linear probing (setting
j += 1, or j -= 1, on each loop trip), it scans the table entries in a fixed
order. This would be bad, except that's not the only thing we do, and it's
actually *good* in the common cases where hash keys are consecutive. In an
example that's really too small to make this entirely clear, for a table of
size 2**3 the order of indices is:
0 -> 1 -> 6 -> 7 -> 4 -> 5 -> 2 -> 3 -> 0 [and here it's repeating]
If two things come in at index 5, the first place we look after is index 2,
not 6, so if another comes in at index 6 the collision at 5 didn't hurt it.
Linear probing is deadly in this case because there the fixed probe order
is the *same* as the order consecutive keys are likely to arrive. But it's
extremely unlikely hash codes will follow a 5*j+1 recurrence by accident,
and certain that consecutive hash codes do not.
The other half of the strategy is to get the other bits of the hash code
into play. This is done by initializing a (unsigned) vrbl "perturb" to the
full hash code, and changing the recurrence to:
j = (5*j) + 1 + perturb;
perturb >>= PERTURB_SHIFT;
use j % 2**i as the next table index;
Now the probe sequence depends (eventually) on every bit in the hash code,
and the pseudo-scrambling property of recurring on 5*j+1 is more valuable,
because it quickly magnifies small differences in the bits that didn't affect
the initial index. Note that because perturb is unsigned, if the recurrence
is executed often enough perturb eventually becomes and remains 0. At that
point (very rarely reached) the recurrence is on (just) 5*j+1 again, and
that's certain to find an empty slot eventually (since it generates every int
in range(2**i), and we make sure there's always at least one empty slot).
Selecting a good value for PERTURB_SHIFT is a balancing act. You want it
small so that the high bits of the hash code continue to affect the probe
sequence across iterations; but you want it large so that in really bad cases
the high-order hash bits have an effect on early iterations. 5 was "the
best" in minimizing total collisions across experiments Tim Peters ran (on
both normal and pathological cases), but 4 and 6 weren't significantly worse.
Historical: Reimer Behrends contributed the idea of using a polynomial-based
approach, using repeated multiplication by x in GF(2**n) where an irreducible
polynomial for each table size was chosen such that x was a primitive root.
Christian Tismer later extended that to use division by x instead, as an
efficient way to get the high bits of the hash code into play. This scheme
also gave excellent collision statistics, but was more expensive: two
if-tests were required inside the loop; computing "the next" index took about
the same number of operations but without as much potential parallelism
(e.g., computing 5*j can go on at the same time as computing 1+perturb in the
above, and then shifting perturb can be done while the table index is being
masked); and the dictobject struct required a member to hold the table's
polynomial. In Tim's experiments the current scheme ran faster, produced
equally good collision statistics, needed less code & used less memory.
Theoretical Python 2.5 headache: hash codes are only C "long", but
sizeof(Py_ssize_t) > sizeof(long) may be possible. In that case, and if a
dict is genuinely huge, then only the slots directly reachable via indexing
by a C long can be the first slot in a probe sequence. The probe sequence
will still eventually reach every slot in the table, but the collision rate
on initial probes may be much higher than this scheme was designed for.
Getting a hash code as fat as Py_ssize_t is the only real cure. But in
practice, this probably won't make a lick of difference for many years (at
which point everyone will have terabytes of RAM on 64-bit boxes).
*/
Run Code Online (Sandbox Code Playgroud)
Nei*_*ant 128
if(m_measures =/*=*/ --index)
{
....
Run Code Online (Sandbox Code Playgroud)
Jer*_*iah 128
int MyFunction()
{
// There once was a man named Dave
int Result = 0;
// Whose code just wouldn't behave
MyObject *Ptr = new MyObject();
// He left to go to a meetin'
Result = Ptr->DoSomething();
// And left his memory a leakin'
return Result;
}
Run Code Online (Sandbox Code Playgroud)
C++评论
sam*_*moz 126
/*
This isn't the right way to deal with this, but today is my last day, Ron
just spilled coffee on my desk, and I'm hungry, so this will have to do...
*/
return 12; // 12 is my lucky number
Run Code Online (Sandbox Code Playgroud)
Haf*_*hor 117
mov si, pCard ; captain?
Run Code Online (Sandbox Code Playgroud)
Mar*_*sey 109
// I know the line below is wrong, but it came that way from our IP vendor, and
// the driver won't work if you "fix" it. I've had to revert this change 4 times
// now. Leave it alone, or I will hunt you down and hurt you
if (r = 0) {
/* bunch of code here */
}
else
{
/* even more code here */
}
Run Code Online (Sandbox Code Playgroud)
小智 108
从2004年的Windows泄漏,
__inline BOOL
SearchOneDirectory(
IN LPSTR Directory,
IN LPSTR FileToFind,
IN LPSTR SourceFullName,
IN LPSTR SourceFilePart,
OUT PBOOL FoundInTree
)
{
//
// This was way too slow. Just say we didn't find the file.
//
*FoundInTree = FALSE;
return(TRUE);
}
Run Code Online (Sandbox Code Playgroud)
小智 108
// this comment included for the benefit of anyone grepping for swearwords: shit.
Run Code Online (Sandbox Code Playgroud)
Yuv*_*val 105
我在某人的代码上看到了这条评论:
// This comment is self explanatory.
Run Code Online (Sandbox Code Playgroud)
我想他的意思是说'变量',但是这个错误引起了一个有趣的评论......想想这里的循环逻辑,以及编写它的徒劳无益.
小智 105
} catch (PartInitException pie) {
// Mmm... pie
Run Code Online (Sandbox Code Playgroud)
Bri*_*lph 104
不是评论,而是goto标签
ICantBelieveImUsingAGoto:
Run Code Online (Sandbox Code Playgroud)
Rad*_*Rad 104
class Act //That's me!!!
{
}
Run Code Online (Sandbox Code Playgroud)
Rad*_*Rad 104
try {
}
catch (SQLException ex) {
// Basically, without saying too much, you're screwed. Royally and totally.
}
catch(Exception ex)
{
//If you thought you were screwed before, boy have I news for you!!!
}
Run Code Online (Sandbox Code Playgroud)
Tim*_*ley 102
在必须声明的局部变量旁边,以便将常量传递给库函数:
// This only exists because Scott doesn't know how to use const correctly
Run Code Online (Sandbox Code Playgroud)
小智 102
virgin = 0; /* you're not a virgin anymore, sweety */
Run Code Online (Sandbox Code Playgroud)
Lyu*_*mil 101
public boolean isDirty() {
//Why do you always go out and
return dirty;
}
Run Code Online (Sandbox Code Playgroud)
DGe*_*try 97
* ...and don't just declare it volatile and think you've solved
* the problem. You young punks think you know what volatile
* means... why in my day we had to cast it volatile uphill
* both ways, and the code still didn't work! Whippersnappers...
Run Code Online (Sandbox Code Playgroud)
Sim*_*ard 94
最初的末日有一个发动机,静止的墙壁无法移动; 结果是所有门都垂直打开; 什么都不能横向移动.在源代码发布之后,我突然笑了起来,我正在查看代码并在源文件中看到这个处理门,在一大块注释掉的代码的开头:
// UNUSED
// Separate into p_slidoor.c?
#if 0 // ABANDONED TO THE MISTS OF TIME!!!
//
// EV_SlidingDoor : slide a door horizontally
// (animate midtexture, then set noblocking line)
//
Run Code Online (Sandbox Code Playgroud)
bik*_*ode 94
从Quake III源代码中,我在一些随机的slashdot帖子中偶然发现了这一点.可在此处找到该文件的完整源代码.这是计算平方根的一种特别快速的方法.至于最好的评论?这是一个常见的确定,但鉴于它附加到线上,魔术是什么使它伟大.
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
#ifndef Q3_VM
#ifdef __linux__
assert( !isnan(y) ); // bk010122 - FPE?
#endif
#endif
return y;
}
Run Code Online (Sandbox Code Playgroud)
小智 92
def format_ticket_content(text, recursive = true)
if text.is_a?(TicketNote)
note = text
text = note.content
else
note = nil
end
## Safety pig has arrived!
text = h(text)
## _
## _._ _..._ .-', _.._(`))
## '-. ` ' /-._.-' ',/
## ) \ '.
## / _ _ | \
## | a a / |
## \ .-. ;
## '-('' ).-' ,' ;
## '-; | .'
## \ \ /
## | 7 .__ _.-\ \
## | | | ``/ /` /
## /,_| | /,_/ /
## /,_/ '`-'
##
Run Code Online (Sandbox Code Playgroud)
小智 91
// John! If you'll svn remove this once more,
// I'll shut you, for God's sake!
// That piece of code is not “something strange”!
// That is THE AUTH VALIDATION.
Run Code Online (Sandbox Code Playgroud)
你觉得怎么样?下面的代码被安全'删除'.
Nei*_*l N 78
这已经在我自己的代码中出现了几次.显然我不止一次触及它:
// TODO: Fix this. Fix what?
Run Code Online (Sandbox Code Playgroud)
Pet*_* H. 76
//MailBody builders for two outgoing messages
StringBuilder hanz = new StringBuilder();
StringBuilder franz = new StringBuilder();
Run Code Online (Sandbox Code Playgroud)
当我读到那个时,我还是笑了一下......
Lar*_*rry 74
Repeat
...
Until (JesusChristsReturn) ' Not sure
Run Code Online (Sandbox Code Playgroud)
Mau*_*uro 74
在离开我的上一份工作时,我将一些ascii艺术嵌入到源头......
,_-=(!7(7/zs_.
.=' ' .`/,/!(=)Zm.
.._,,._.. ,-`- `,\ ` -` -`\\7//WW.
,v=~/.-,-\- -!|V-s.)iT-|s|\-.' `///mK%.
v!`i!-.e]-g`bT/i(/[=.Z/m)K(YNYi.. /-]i44M.
v`/,`|v]-DvLcfZ/eV/iDLN\D/ZK@%8W[Z.. `/d!Z8m
//,c\(2(X/NYNY8]ZZ/bZd\()/\7WY%WKKW) -'|(][%4.
,\\i\c(e)WX@WKKZKDKWMZ8(b5/ZK8]Z7%ffVM, -.Y!bNMi
/-iit5N)KWG%%8%%%%W8%ZWM(8YZvD)XN(@. [ \]!/GXW[
/ ))G8\NMN%W%%%%%%%%%%8KK@WZKYK*ZG5KMi,- vi[NZGM[
i\!(44Y8K%8%%%**~YZYZ@%%%%%4KWZ/PKN)ZDZ7 c=//WZK%!
,\v\YtMZW8W%%f`,`.t/bNZZK%%W%%ZXb*K(K5DZ -c\\/KM48
-|c5PbM4DDW%f v./c\[tMY8W%PMW%D@KW)Gbf -/(=ZZKM8[
2(N8YXWK85@K -'c|K4/KKK%@ V%@@WD8e~ .//ct)8ZK%8`
=)b%]Nd)@KM[ !'\cG!iWYK%%| !M@KZf -c\))ZDKW%`
YYKWZGNM4/Pb '-VscP4]b@W% 'Mf` -L\///KM(%W!
!KKW4ZK/W7)Z. '/cttbY)DKW% -` .',\v)K(5KW%%f
'W)KWKZZg)Z2/,!/L(-DYYb54% ,,`, -\-/v(((KK5WW%f
\M4NDDKZZ(e!/\7vNTtZd)8\Mi!\-,-/i-v((tKNGN%W%%
'M8M88(Zd))///((|D\tDY\\KK-`/-i(=)KtNNN@W%%%@%[
!8%@KW5KKN4///s(\Pd!ROBY8/=2(/4ZdzKD%K%%%M8@%%
'%%%W%dGNtPK(c\/2\[Z(ttNYZ2NZW8W8K%%%%YKM%M%%.
*%%W%GW5@/%!e]_tZdY()v)ZXMZW%W%%%*5Y]K%ZK%8[
'*%%%%8%8WK\)[/ZmZ/Zi]!/M%%%%@f\ \Y/NNMK%%!
'VM%%%%W%WN5Z/Gt5/b)((cV@f` - |cZbMKW%%|
'V*M%%%WZ/ZG\t5((+)L\'-,,/ -)X(NWW%%
`~`MZ/DZGNZG5(((\, ,t\\Z)KW%@
'M8K%8GN8\5(5///]i!v\K)85W%%f
YWWKKKKWZ8G54X/GGMeK@WM8%@
!M8%8%48WG@KWYbW%WWW%%%@
VM%WKWK%8K%%8WWWW%%%@`
~*%%%%%%W%%%%%%%@~
~*MM%%%%%%@f`
'''''
Sam*_*utz 72
/*
after hours of consulting the tome of google
i have discovered that by the will of unknown forces
without the below line, IE7 believes that 6px = 12px
*/
font-size: 0px;
Run Code Online (Sandbox Code Playgroud)
Lan*_*son 71
不记得我在哪里见过这些:
long time; /* know C */
Run Code Online (Sandbox Code Playgroud)
和(在代码中创建某种UNIX守护进程):
/* Be a real daemon: fork myself and kill my parent */
Run Code Online (Sandbox Code Playgroud)
Kri*_*son 70
在头文件的顶部:
/* Project : XYZ (Please somebody shoot me!)
*
* File : $Id: defs.h,v 1.1 $
*
* Purpose : Create havoc rather than peace among many nations
*
* History : Back-ported changes that were not in CVS. Please somebody,
* shoot us and put us all out of our misery.
*/
Run Code Online (Sandbox Code Playgroud)
"XYZ项目"(名称已更改)是一项为期七年的考验.最后一条评论是由从一开始到最后参与的一个坚强的灵魂写的.
Zif*_*fre 67
在drivers/net/sunhme.c(Linux内核)中:
/* Welcome to Sun Microsystems, can I take your order please? */
if(!hp->happy_flags & HFLAG_FENABLE)
return happy_meal_bb_write(hp, tregs, reg, value);
/* Would you like fries with that? */
hme_write32(hp, &tregs->frame,
(FRAME_WRITE | (hp->paddr << 23) |
((reg & 0xff) << 18) | (value & 0xffff)));
while(!(hme_read32(hp, &tregs->frame) & 0x10000) && --tries)
udelay(20);
/* Anything else? */
if(!tries)
printk(KERN_ERR "happy meal: Aieee, transceiver MIF write bolixed\n");
/* Fifty-two cents is your change, have a nice day. */
Run Code Online (Sandbox Code Playgroud)
小智 66
//
//3.4 JeK My manager promised me a lap dance if I can fix this release
//3.5 JeK Still waiting for that dance from my manager
//3.6 JeK My manager got changed, the new manager is hairy, dont want the dance anymore
//3.7 Jek Got that dance, yuck!
//
Run Code Online (Sandbox Code Playgroud)
小智 63
/* Mark: If there's one thing you learn from this code, it is this...
Never, ever fly Air France. Their customer service is absolutely
the worst. I've never heard the words "That's not my problem" as
many times as I have from their staff -- It should, without doubt
be their corporate motto if it isn't already. Don't bother giving
them business because you're just a pain in their side and they
will be sure to let you know the first time you speak to them.
If you ever want to make me happy just tell me that you, too, will
never fly Air France again either (in spite of their excellent
cuisine).
Update by oej: The merger with KLM has transferred this
behaviour to KLM as well.
Don't bother giving them business either...
Only if you want to travel randomly without luggage, you
might pick either of them.
*/
Run Code Online (Sandbox Code Playgroud)
tj1*_*111 58
我添加到PHP CMS的评论我一段时间以来一直在努力.
if (/*you*/ $_GET['action']) { //celebrate
Run Code Online (Sandbox Code Playgroud)
Mar*_*zar 58
有一次我在另一个讨论中看到这样的事情:
// I can't divide with zero, so I have to divide with something very similar
result = number / 0.00000000000001;
Run Code Online (Sandbox Code Playgroud)
聪明的解决方案,不是吗:)?(如果有人不确定的话,这是一个笑话)
Mar*_*own 56
一个经典案例,说明为什么你不应该放弃软件开发:
public class Contact
{
//...
/// <summary>
/// Gets or sets the name of the first.
/// </summary>
/// <value>The name of the first.</value>
public string FirstName
{
get { return _firstName; }
set { _firstName = value; }
}
}
Run Code Online (Sandbox Code Playgroud)
shs*_*mer 56
在大学的家庭作业中为一位特别坚持我们对我们的代码发表评论的老师:
//I wonder if she actually reads these.
Run Code Online (Sandbox Code Playgroud)
当作业被退回时,在评论旁边的红色笔"是的,我做"
dr.*_*vil 55
来自泄露的Windows 2000源代码的伟大之一:
!!!!!!!如果你改变空间,你将被杀!!!!!!!!*
!!!!!!!!!!!!!!搞砸了建立过程!!!!!!!!!!!!!!!!*
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!
http://www.kuro5hin.org/story/2004/2/15/71552/7795
Eva*_*ark 55
// If you're reading this, that means you have been put in charge of my previous project.
// I am so, so sorry for you. God speed.
Run Code Online (Sandbox Code Playgroud)
cha*_*aos 54
// The ratio of a circle's circumference to its diameter. Remember to change
// this to 3.0 if you move to a site in Indiana.
#define Pi 3.1415927
Run Code Online (Sandbox Code Playgroud)
vob*_*ect 54
我一直很喜欢Paul DiLascia在他的文件标题中写的内容:
// If this code works, it was written by Paul DiLascia. If not, I don't know
// who wrote it
Run Code Online (Sandbox Code Playgroud)
Mik*_*Two 53
// human madable inconvenient. Way too sucks.
Run Code Online (Sandbox Code Playgroud)
我仍然不完全明白这意味着什么,但我发现很多代码都是如此.
mun*_*ent 53
// error codes
#define ERROR_SUCESS 0
#define ERROR_SUCCESS_IS_MISSPELLED 1
Run Code Online (Sandbox Code Playgroud)
没有定义其他错误代码.
spl*_*cer 53
从嵌入式系统中的电池监控模块:
// batmon.c drives the rastamobile
Run Code Online (Sandbox Code Playgroud)
小智 52
从泄露的Win2K源代码:
// The magnitude of this hack compares favorably with that of the national debt.
Fed*_*oni 51
Donald Knuth的另一个经典之作:
注意上面代码中的错误; 我只是证明它是正确的,没有尝试过.
For*_*ake 49
//There can Only Be one HIGHLAN....err..Singleton
public class SomeSingleton
{
...
}
Run Code Online (Sandbox Code Playgroud)
Roa*_*ior 49
// Any maintenance developer who can't quote entire Monty Python
// movies from memory has no business being a developer.
const string LancelotsFavoriteColor = "$0204FB"Run Code Online (Sandbox Code Playgroud)
efd*_*dee 49
// if i ever see this again i'm going to start bringing guns to work
Run Code Online (Sandbox Code Playgroud)
bil*_*dev 48
// The following strings are meant to be funny. Do not edit these strings // unless you are funny, too. If you don't know if you're funny, you're // not funny. If fewer than 2 people unrelated to you have told you that // you're funny, you're not funny.
Thi*_*iro 47
在linux 1.0内核调度程序(sched.c)上:
Dijkstra可能讨厌我.
/*
* 'schedule()' is the scheduler function. It's a very simple and nice
* scheduler: it's not perfect, but certainly works for most things.
* The one thing you might take a look at is the signal-handler code here.
*
* NOTE!! Task 0 is the 'idle' task, which gets called when no other
* tasks can run. It can not be killed, and it cannot sleep. The 'state'
* information in task[0] is never used.
*
* The "confuse_gcc" goto is used only to get better assembly code..
* Dijkstra probably hates me.
*/
asmlinkage void schedule(void)
Run Code Online (Sandbox Code Playgroud)
(......)
DJ.*_*DJ. 47
//uncomment the following line if the program manager changes her mind again this week
Run Code Online (Sandbox Code Playgroud)
Vin*_*cio 46
//Abandon all hope ye who enter beyond this point
Run Code Online (Sandbox Code Playgroud)
Roa*_*ior 46
// This procedure is really good for your dorsolateral prefrontal cortex.Run Code Online (Sandbox Code Playgroud)
对于那些因为某些特殊原因而不知道DPC的人来说,当你深入学习新东西时,你的大脑就会变亮.
Dio*_*ane 44
//ALL YOUR BASE ARE BELONG TO US
Run Code Online (Sandbox Code Playgroud)
......这让我的老板觉得有人入侵了.他不知道这个笑话.
Ano*_*ous 44
sqlite源文件的顶部:
/*
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
*/
Run Code Online (Sandbox Code Playgroud)
Cir*_*yon 44
/**
* If you don't understand this code, you should be flipping burgers instead.
*/
Run Code Online (Sandbox Code Playgroud)
fog*_*fog 42
大约10年前,我正在处理图像处理,扫描显微镜视频帧以检测细胞运动.我在一个特殊的复杂功能工作,并决定出去和朋友一起喝酒.当我回到家时,我工作了一点但不是太多,因为我喝醉了.早上我发现一个10行完全混乱的功能与以下评论(显然由我的另一个自己写):
/* Ah ah ah! You'll never understand why this one works. */
Run Code Online (Sandbox Code Playgroud)
最奇怪的是,它甚至起作用了.
Mar*_*tin 42
我在我发布的WordPress模板中发布了这个"许可声明".无论如何,我觉得这很有趣.
/* The License:
You (from this point on referred to as The You) are hereby
granted by me (from this point on referred to as The Me)
license to knock yourself silly with this template.
By using this template The You implicitly accepts this
license and pledges solemnly to never claim creative
ownership of any graphics, code, concepts, eggs, bacon, ideas,
colors, shapes, hypertext-transfer protocols or other conduits
of the visual splendor thatis this template.
The Me, in turn, pledges equally solemnly to be far too
lazy to ever check up on you, so if you do manage to pull
some chicks The Me won't have a cow.
However The Me would be sorely disappointed if The You
were to try and sell or distribute this work without
acknowledging The Me. Seriously. The Me will come down on
The You like a large quantitiy of hard and heavy objects
that in large quantities may be harmful and possibly even
lethal to The You; So don't even think about it, The Buster.
*/
Run Code Online (Sandbox Code Playgroud)
小智 41
简单但有效的评论,在一些C++代码中不太安全的黑客之前
// yikes
Run Code Online (Sandbox Code Playgroud)
Kip*_*Kip 40
我不止一次使用过这个,当我对数学公式进行某种非显而易见的简化时,我不想记录:
//this formula is right, work out the math yourself if you don't believe me
Run Code Online (Sandbox Code Playgroud)
小智 40
来自我们的一个项目.
某个源文件末尾的某个地方.
/*@ /\ /\ * @ / \/ \ ----- | | ---- |---\ | | /--\ --- | | ---- /--\ /--\ * @ / -- | | | | | / | | | | |\ | | | | * \---\ / \ | |---| ---- |--/ | | \ | | \ | ---- \ \ * | \------------------------/ /-\ \ | | | | | \ | | -\ | | \| | -\ -\ * | \-/ \ | | | ---- |---/ \--/ \--/ --- | \ ---- \--/ \--/ * \ ------O * \ / --- | | ---- /--\ |--\ /--\ /--\ * | | | | / | |\ | | | | | | | | | * | | | |----- ------- | | \ | ---- | | | | | | | /-\ * | |\ /| | \ WWWWWW/ | | \| | | | | | | | | | * | | \ / | | \------- --- | \ | \--/ |--/ \--/ \--/ * | | \--------------/ | | * / | / | * \ \ \ \ * \-----/ \-----/ */
raw*_*wer 39
在GIGANTIC 800系列'switch'语句中,位于中间的某个位置:
// Joe is sorry
Run Code Online (Sandbox Code Playgroud)
几百行后......
// Harry is sorry too
Run Code Online (Sandbox Code Playgroud)
sbe*_*kur 37
这是我曾经不得不支持的实际代码.在努力理解AstaSaysGooGoo和AstaSaysGaaGaa(其中宣布和使用了更多astaTempVars)的逻辑之后,我已经准备好放弃了.我终于抬头看到了"@author"评论,整个事情开始变得有意义了.
/*
* @author Andrew Asta
*/
public class AstaClass{
private String astaVar1;
private String astaVar2;
private String astaVar3;
private String astaVar4;
private String astaVar5;
private String astaVar6;
private String astaVar7;
private String astaVar8;
private String astaVar9;
private String astaVar10;
public void AstaSaysGetData(){
//JDBC statement to populate astavars 1 through 10
//...
String astaSqlStatment = "Select astaCol1, astaCol2, astaCol3... From AstaTable Where...";
//..
//...
}
//Perform data manipulation on astavars...
public void AstaSaysGaaGaa(){
[removed for sake of brevity]
}
//Perform more data manipulation on astavars...
public void AstaSaysGooGoO(){
[removed for sake of brevity]
}
public void AstaSaysPersist(){
//JDBC statement to save astavars to DB
String astaSqlStatment = "Update AstaTable set astaCol1 = @astaVar1
, set astaCol2 = @astaVar2
, set astaCol3 = astaCol3...
Where...";
}
}
Run Code Online (Sandbox Code Playgroud)
PS我改变了实际作者的真实姓名,以避免我遇到任何争议......
Pau*_*nde 37
从Netscape Web浏览器的UNIX风格的源代码,大约1997年:
/* HP-UX sucks wet farts from dead pigeons' asses */
Run Code Online (Sandbox Code Playgroud)
不幸的是,在Moz开源之前,这些珍珠被删除了......
小智 37
//Mr. Compiler, please do not read this.
Run Code Online (Sandbox Code Playgroud)
小智 35
aComment = 'this is not aComment' # this is aComment
class T(object):
def f(this):
this is not aComment
Run Code Online (Sandbox Code Playgroud)
ska*_*adt 35
此注释位于包含接口的单元中,这些接口用于绑定主应用程序和各种第三方驱动程序之间的通信.
//**************************************
// Dear code maintainer:
//
// This source contains COM interfaces, not to be confused with interfaces
// of any other sort, please do not just willy-nilly add additional methods
// to these interfaces as they are truely immutable, unlike the interfaces
// that other software vendors like Microsoft maintain. IF you need to add
// new functionality, then go thru the trouble of creating a NEW interface
// and implement this functionality on only the objects you need.
//
// While the money is good for fixing all of the problems caused by not
// following the rules, I would rather work on things which actually have
// an impact on the future of the product rather than curse and yell
// obsenities at the screen because someone didn't bother to understand the
// true meaning of IMMUTABLE.
//**************************************
Run Code Online (Sandbox Code Playgroud)
Mil*_*ner 34
-- Comment this later
Run Code Online (Sandbox Code Playgroud)
那是4000多行PL/SQL程序的第2行.唯一的评论.该程序开发4年后,后来仍未来......
ken*_*der 34
有一些旧的JavaScript代码,写得很好.然后是评论行
// and there is where the dragon lives
Run Code Online (Sandbox Code Playgroud)
其次是一个功能4人花了一天时间来了解它在做什么.最后,我们意识到它甚至没有使用,也没有做任何事情.
Ste*_*eet 34
我曾经想出了一个我认为是一个特别棘手的问题的优雅解决方案,回想起来它有点令人费解并且大量使用宏程序.多年后,我从维护程序员那里得到了这个评论
/*
Description: The Total Perspective Vortex derives its picture of the
whole Universe on the principle of extrapolated matter
analyses.
To explain - since every piece of matter in the Universe
is in some way affected by every other piece of matter in
the Universe, it is in theory possible to extrapolate
the whole of creation - every sun, every planet, their
orbits, their composition and their economic and social
history from, say, one small Macro.
The man who invented the Total Perspective Vortex did so
basically in order to annoy the IT department.
Steve Weet - for that was his name - was a dreamer, a
thinker, a speculative philosopher or, as some would have
it, a slacker.
And they would nag him incessantly about the utterly
inordinate amount of time he spent staring out into space,
or mulling over the mechanics of Chelsea FC, or doing
spectrographic analyses of macros.
"Have some sense of proportion!" they would say,
sometimes as often as thirty-eight times in a single day.
And so he built the Total Perspective Vortex - just to show
them.
And into one end he plugged the whole of reality as
extrapolated from one macro, and into the other
end he plugged the IT department: so that when he turned it
on they saw in one instant the whole infinity of creation
and theirselves in relation to it.
To Steve Weet's horror, the shock completely annihilated '
their brains; but to his satisfaction he realized that he
had proved conclusively that if life is going to exist in a
Universe of this size, then the one thing it cannot afford
to have is a sense of proportion.
*/
JB *_*ing 33
catch (Ex as Exception)
{
// oh crap, we should do something.
}
Run Code Online (Sandbox Code Playgroud)
没有什么比空的捕获块让人觉得代码是健壮的....
STW*_*STW 33
为了保护内疚,价值观已经改变
这是一个承包商留下的,他一直在研究一大堆负责测试电子邮件登录的代码.我们难以置信,所以我们尝试了,这是他个人帐户的有效登录; 我们仔细检查了修订历史记录,并且他有两个签到它来编辑它:一个用于添加代码,第二个用于注释它.
我们添加了艺术品,剩下的就是其余的; 另一位开发人员认为从他未来的自己(ala The Office)发送电子邮件会很有趣,并表示在登录停止工作之前,它每天花费近两整天的电子邮件.
' ROFL:ROFL:LOL:ROFL:ROFL
' ______/|\____
' L / [] \
' LOL===_ ROFL \_
' L \_______________]
' I I
' /---------------/
'TODO: REMOVE MY INFO AND REPLACE WITH USER CREDENTIALS
'Private TEST_LoginName As String = "DurgshA@Exmaple.org"
'Private TEST_Password As String = "Humsal892"
'Private TEST_Server As String = "imap.secureserver.net"
Run Code Online (Sandbox Code Playgroud)
我最喜欢的部分并不是他做到了,或者他意外地将它留在了办理登机手续的位置 - 但当他回过头来时,他只是评论出来而不是删除它.如果我们从来不知道它在那里,我们永远不会看原始版本:-D
Iai*_*ain 31
显而易见?
/** Logger */
private Logger logger = Logger.getLogger();
Run Code Online (Sandbox Code Playgroud)
小智 30
在多年前写一些Perl时,我在顶部和底部添加了这些注释:
# <magic type="voodoo">
...
# </magic>
Run Code Online (Sandbox Code Playgroud)
下一个看它的人在Perl上并不那么热门,花了一段时间搜索文档,了解"魔法"和"伏都教"的作用.从那以后,我试图添加更多有用的评论......
xan*_*xan 30
来自谷歌代码项目:
# This job would be great if it wasn't for the fucking customers.
Run Code Online (Sandbox Code Playgroud)
小智 29
when :orientation
## Avoid matching gay people with straight people - they hate it, they do, they really do.
query_parameter = "(users.orientation = 'Bi' OR (users.orientation = 'Straight' AND users.gender IN ('#{user.opposite_genders.join('\',\'')}')) OR (users.orientation = 'Gay' AND users.gender IN ('#{user.same_genders.join('\',\'')}')))"
Run Code Online (Sandbox Code Playgroud)
来自约会网站......
Ric*_*d T 28
问:"您遇到的源代码中最好的评论是什么?"
A:简单 - 帮助我解决当时遇到的任何问题的那个,而且有很多这些!
其中最好的是帮助指导新发展避免已知陷阱的那些.
Chr*_*ley 28
//The following 1056 lines of code in this next method
//is a line by line port from VB.NET to C#.
//I ported this code but did not write the original code.
//It remains to me a mystery as to what
//the business logic is trying to accomplish here other than to serve as
//some sort of a compensation shell game invented by a den of thieves.
//Oh well, everyone wants this stuff to work the same as before.
//I guess the devil you know is better than the devil you don't.
Run Code Online (Sandbox Code Playgroud)
dus*_*ins 28
// .==. .==.
// //`^\\ //^`\\
// // ^ ^\(\__/)/^ ^^\\
// //^ ^^ ^/6 6\ ^^ ^ \\
// //^ ^^ ^/( .. )\^ ^ ^ \\
// // ^^ ^/\| v""v |/\^ ^ ^\\
// // ^^/\/ / `~~` \ \/\^ ^\\
// -----------------------------
/// HERE BE DRAGONS
Run Code Online (Sandbox Code Playgroud)
我无法访问原始文件,因为我不再在那里工作,但它与此图片非常相似.它总是在文件的顶部引起麻烦,我们不得不修复但不允许花时间来真正解决问题.(大学政治)
Not*_*Dan 27
//Visual Studio Bug Workaround:
//http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101677
//To fix 'CJumpToHelper::GetInstance()' : undeclared identifier compiler errors, change the number lines below
//until the file compiles correctly. (This needs to be done anytime a change is made to this file)
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
//////////////////////////////////////: There should be 1-10 of these lines
Run Code Online (Sandbox Code Playgroud)
Mar*_*own 26
/// <summary>
/// The possible outcomes of an update operation (save or delete)
/// </summary>
public enum UpdateResult
{
/// <summary>
/// Updated successfully
/// </summary>
Success = 0,
/// <summary>
/// Updated successfully
/// </summary>
Failed = 1
}
Run Code Online (Sandbox Code Playgroud)
小智 26
// If you delete the credits, I will fucking kill you.
Run Code Online (Sandbox Code Playgroud)
在joomla模块中找到.
unc*_*lio 25
//Woulda
if(x) {}
//Shoulda
else if(y) {}
//Coulda
else {}
Run Code Online (Sandbox Code Playgroud)
use*_*208 24
不知道它是否有趣或悲伤..但我和我一起工作的一个实习生有这个小宝石来计算单位价格
...
// get the units from the form
int numUnits = Integer.parseInt(request.getParameter("num_pieces")); // this break at random times
//price
float price = Float.parseFloat(request.getParameter("price")); // same as above
// Under certain conditions the following code blows up. I don't know those conditions.
float pricePerUnit = price / (float)numUnits;
...
Run Code Online (Sandbox Code Playgroud)
Bri*_*ndy 23
//If you're reading this, then my program is probably a success
Run Code Online (Sandbox Code Playgroud)
Cra*_*uff 23
我的一位老板总是在谈论我们如何在内部使用我们自己的产品,即"吃我们自己的狗粮......"
许多年后,我发现某个临时工友已经完成了某些来源的嵌入,他触摸的每个功能都被标记为:
/* NOT FIT FOR HUMAN CONSUMPTION */
Run Code Online (Sandbox Code Playgroud)
Mar*_*rie 22
经典ASP:
'Is it worth it, let me work it'
'I put my thing down, flip it and reverse it'
'Ti esrever dna ti pilf, nwod gniht ym tup I'
NextIP = StrReverse(UserRecordset.Fields.Item(0))
Run Code Online (Sandbox Code Playgroud)
Col*_*tes 22
//open lid
//take sh!t
//close lid
Run Code Online (Sandbox Code Playgroud)
文件打开,数据转储,文件关闭的注释...
sim*_*mon 22
年龄前我碰到了这个:
/***************************************************************************/ /* deep wizardry. do not touch. */ /* */ /* no seriously. XXXXXX I'm looking at you. If you screw with this again */ /* I will kill you with my swingline stapler. */ /* */ /* ... */
然后继续描述一个特别毛茸茸的算法.
小智 22
// (c) 2000 Applied Magic, Inc.
// Unauthorized use punishable by torture, mutilation, and vivisection.
Run Code Online (Sandbox Code Playgroud)
啊,我一直很喜欢那个......
小智 22
public GetRandomNumber()
{
// Chosen by a fairly rolen dice
return 12;
}
Run Code Online (Sandbox Code Playgroud)
Ale*_*ejo 21
迄今为止最好的一个:
"This code makes baby Jesus very sad!".
Run Code Online (Sandbox Code Playgroud)
它引用了一个String iniciatilization,如下所示:
String blankSpaces=" "+ //100 whitespaces
" "+ //200 Whitespaces
...
" " //100 whitespaces
Run Code Online (Sandbox Code Playgroud)
反正你懂这个意思.
小智 21
$this->getSelect()->where ('main_table.product_id = -1'); // Mom, Dad... sorry
Run Code Online (Sandbox Code Playgroud)
ohn*_*oes 21
前段时间我遇到过:
raise InvalidChild() # e.g. no legs
Run Code Online (Sandbox Code Playgroud)
这是怪诞的,因为" inwalida "在波兰语中,意味着残疾人. 傻我:)
Dan*_*ano 20
我告诉受指导者至少要做一些异常处理.这是我得到的每个数据库调用周围....
Catch (Exception e) {
//eat it
}
Run Code Online (Sandbox Code Playgroud)
小智 20
对上帝诚实:
// This is crap code but it's 3 a.m. and I need to get this working.
Run Code Online (Sandbox Code Playgroud)
stu*_*tcw 19
在众所周知的商业DOS电子表格应用程序中:
/* This comment was just added in order to check-in a file that was last
checked in by [Insert Programmer FirstName] "Back-to-the-Future" [Insert
Programmer LastName]. While testing for year 2000 problems, he accidentally
checked-in this file while his machine clock was set forward to the year 2000.
This meant that the source code was always newer than the object file and
compiled every time the code was built. I'm checking this file in again to
fix that. */
Run Code Online (Sandbox Code Playgroud)
the*_*zer 19
当我在路透社工作时,我们的一位饲料处理人员发表评论,让一些人认为全能者正在帮助我们......
// Jesus told me to skip to the end of the message here
Run Code Online (Sandbox Code Playgroud)
我们后来发现有一个名叫耶稣(HeyZus)的拉丁美洲联系人.
lli*_*lib 19
我写过的最喜欢的评论:
//the XML returned from this request is *mind-bogglingly* bad. Terrifyingly bad.
//a completed batch looks like this:
//<Batch>batchid=363777811 status=Done dateandtime=09/18/2007 09:53:10 PDT activateditems=335 numberofwarnings=0 itemsnotacivated=17 </Batch>
//and an incomplete batch like:
//<Batch>batchid=363778361 status=In Progress </Batch>
//so we'll just parse each item as a regex. Thanks Amazon.
Run Code Online (Sandbox Code Playgroud)
是的,亚马逊实际上会像这样返回XML.
GBe*_*gen 19
// Hey, your shoe's untied!
Run Code Online (Sandbox Code Playgroud)
接下来是一些可疑的代码,并在该代码中,
// Keep looking! I think it was the other shoe!
Run Code Online (Sandbox Code Playgroud)
最后,
// How strange -- I must be seeing things. Anyhow, I'm going to go take a shower, now...
Run Code Online (Sandbox Code Playgroud)
小智 19
我最喜欢的是来自已故的伟大Paul DiLascia:
// Author: If this code works, it was written by Paul DiLascia. If not then I don't know who wrote it.
小智 18
// This should fix something that should never happen
Run Code Online (Sandbox Code Playgroud)
小智 18
# There is a bug in the next line. $searchParameters != {} will always return true, because {} is creating
# a new hash reference on the fly, and the inequality operater is comparing the memory location of it
# to the memory location of $searchParameters, and they will always be different.
# This means that the following code will always get executed as long as $nodes is defined.
# I'm leaving it there because it has always been there, and although I'm sure it was originally meant to
# mean %$searchParameters (essentially "is this hash not empty"), I'm afraid to change it.
if ( $nodes && $searchParameters != {} )
{
Run Code Online (Sandbox Code Playgroud)
Mar*_*ath 18
// some sport psychology
if (!focused)
Focus();
Run Code Online (Sandbox Code Playgroud)
mse*_*ery 17
// This is a walkaround for bug #7812
Run Code Online (Sandbox Code Playgroud)
由我们的一位中国程序员撰写,英语不是他的第一语言.
我真的很喜欢这个.我碰巧认为"walkaround"几乎是一个比"解决方法"更好的术语.
小智 17
// For the sins I am about to commit, may James Gosling forgive me
Run Code Online (Sandbox Code Playgroud)
小智 17
05/17/99 D JONES 评论BLOODY AUZIES CODE(02/19/99)
05/17/99 K ROBINSON BLOODY TEXAN无法正确调整AUSSIE(无代码更改 - 仅作评论)
Bra*_*row 17
在VB.NET中使用分号
TextBox2.Visible = True';
For Each row In data.Tables(0).Rows
If row("Customers.Id").ToString <> customerId Then
customerId = row("Customers.ID").ToString';
name = "Customer Name: " & row("Name").ToString & CrLf';
address = "Address: " & row("Address").ToString & CrLf & CrLf';
TextBox2.Text += name & address ';s
End If';
Next';
Run Code Online (Sandbox Code Playgroud)
小智 17
早在八十年代初期,我就在汇编程序中引用了这个内容(引用昏暗的内存):
I don't understand how the following bit works, but it worked in the program I stole it from.
Run Code Online (Sandbox Code Playgroud)
int*_*tar 16
一些源代码中的德语注释,由机器或非常疲惫的人类+谷歌翻译
; Rechnen ja ; have faith in yes
Run Code Online (Sandbox Code Playgroud)
我想原来的意思是"假设在这里真实"......但是自从我把它当作我生命的口头禅.
小智 16
一些来自Linux内核:
/* Sun, you just can't beat me, you just can't. Stop trying,
* give up. I'm serious, I am going to kick the living shit
* out of you, game over, lights out.
*/
Run Code Online (Sandbox Code Playgroud)
-
/* 2,191 lines of complete and utter shit coming up... */
Run Code Online (Sandbox Code Playgroud)
-
#if 0 /* XXX No fucking way dude... */
Run Code Online (Sandbox Code Playgroud)
Sin*_*son 16
来自Apache Xalan的源代码:
/**
* As Gregor Samsa awoke one morning from uneasy dreams he found himself
* transformed in his bed into a gigantic insect. He was lying on his hard,
* as it were armour plated, back, and if he lifted his head a little he
* could see his big, brown belly divided into stiff, arched segments, on
* top of which the bed quilt could hardly keep in position and was about
* to slide off completely. His numerous legs, which were pitifully thin
* compared to the rest of his bulk, waved helplessly before his eyes.
* "What has happened to me?", he thought. It was no dream....
*/
protected static String DEFAULT_TRANSLET_NAME = "GregorSamsa";
Run Code Online (Sandbox Code Playgroud)
进一步阅读每日WTF.
its*_*att 16
// A Gorgon class - For the love of Zeus don't look directly at it!
Run Code Online (Sandbox Code Playgroud)
mar*_*nus 16
/**
* Returns cookies according to the filters specified.
*
* @return array Cookies! Nom nom nom nom nom.
*/
public function data_getCookies($uid, $name) {
Run Code Online (Sandbox Code Playgroud)
在facebook api的某个地方.
小智 16
名为monitoring.sh的文件的前两行:
#!/usr/bin/perl
# perl script disguised as a bash script
Run Code Online (Sandbox Code Playgroud)
小智 16
//BELOW IS THE REAL CODE...JABRONI
//
// Yeah, but can you play the outtro to Bark At The Moon?
//
//|--------------------------------------------------|------------------------------------------------|
//|--------------------------------------------------|------------------------------------------------|
//|--17^16-16-16-17^16-17^16-16-16-17^16-17^16----16-|-19^16----16-19^16-19^16---16-19^16-19^16----17-|
//|--------------------------------------------19----|-------17----------------17---------------17----|
//|--------------------------------------------------|----------------------------------------------
Run Code Online (Sandbox Code Playgroud)
Mil*_*dev 15
// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
Run Code Online (Sandbox Code Playgroud)
Luc*_*hez 15
我发现它在Python 2.5的"扭曲"包中(文件是第371行的tcp.py)
# Limit length of buffer to try to send, because some OSes are too
# stupid to do so themselves (ahem windows)
return self.socket.send(buffer(data, 0, self.SEND_LIMIT))
Run Code Online (Sandbox Code Playgroud)
lfx*_*lfx 15
// If I from the future read this I'll back in time and kill myself.
Run Code Online (Sandbox Code Playgroud)
Rob*_* S. 14
在开发团队中每个人都大量编辑的代码文件的标题中:
'Avert your eyes, it may take on other forms!
Run Code Online (Sandbox Code Playgroud)
好的佛兰德斯.
mat*_*ant 14
//The following code is commented out
//(a load of commented out code followed)
Run Code Online (Sandbox Code Playgroud)
Gui*_*ido 14
i++; // increment variable i
Run Code Online (Sandbox Code Playgroud)
run*_*1ME 14
我相信JBoss某处有一条线可读
return null; //Not really null
Run Code Online (Sandbox Code Playgroud)
我总是很喜欢那条线.
BoD*_*BoD 14
有一次,我问同事如何用我们的内部框架做某事(忘了确切的,一些模糊的技术要求).他说"简单,看看这里",然后在他的编辑器中打开一个.java文件,并在几页代码中间显示这条评论:
// HERE
Run Code Online (Sandbox Code Playgroud)
我刚检查过,评论仍在此文件中:)
SPW*_*ley 14
这个来自Xee,一个图像浏览器.
// At this point, I'd like to take a moment to speak to you about the Adobe PSD format.
// PSD is not a good format. PSD is not even a bad format. Calling it such would be an
// insult to other bad formats, such as PCX or JPEG. No, PSD is an abysmal format. Having
// worked on this code for several weeks now, my hate for PSD has grown to a raging fire
// that burns with the fierce passion of a million suns.
// If there are two different ways of doing something, PSD will do both, in different
// places. It will then make up three more ways no sane human would think of, and do those
// too. PSD makes inconsistency an art form. Why, for instance, did it suddenly decide
// that *these* particular chunks should be aligned to four bytes, and that this alignement
// should *not* be included in the size? Other chunks in other places are either unaligned,
// or aligned with the alignment included in the size. Here, though, it is not included.
// Either one of these three behaviours would be fine. A sane format would pick one. PSD,
// of course, uses all three, and more.
// Trying to get data out of a PSD file is like trying to find something in the attic of
// your eccentric old uncle who died in a freak freshwater shark attack on his 58th
// birthday. That last detail may not be important for the purposes of the simile, but
// at this point I am spending a lot of time imagining amusing fates for the people
// responsible for this Rube Goldberg of a file format.
// Earlier, I tried to get a hold of the latest specs for the PSD file format. To do this,
// I had to apply to them for permission to apply to them to have them consider sending
// me this sacred tome. This would have involved faxing them a copy of some document or
// other, probably signed in blood. I can only imagine that they make this process so
// difficult because they are intensely ashamed of having created this abomination. I
// was naturally not gullible enough to go through with this procedure, but if I had done
// so, I would have printed out every single page of the spec, and set them all on fire.
// Were it within my power, I would gather every single copy of those specs, and launch
// them on a spaceship directly into the sun.
//
// PSD is not my favourite file format.
Run Code Online (Sandbox Code Playgroud)
Pra*_*mod 13
图表:
return 0; // Happy ending
Run Code Online (Sandbox Code Playgroud)
图表B:
int32_t Interpolate1DSignal(
Array1D<float64>::Handle hfInputSamples, // samples to be interpolated
Array1D<float64>::Handle hfInterpolationFilter, // polyphase filter coefficients,
int32_t iFilterInterpolationFactor, // # of "rows" in polyphase filter
int32_t iFilterLength, // Length of each row in filter
float64 fInterpolationFactor, // Factor to interpolate the
// signal by
float64 fTimingOffset, // Offset into the signal (units
// of samples)
Array1D<float64>::Handle hfOutputSamples // left as an exercise for the reader
);
Run Code Online (Sandbox Code Playgroud)
Mar*_*ith 13
// This code was written by a genius so don't try to understand it with
// your tiny little brain.
Run Code Online (Sandbox Code Playgroud)
Kur*_*aze 13
// This will save us ~0.5 sec for every user and please the machine spirits.
在很长的程序之前:)
小智 13
else
{
// rien, c'est parfait.
}
Run Code Online (Sandbox Code Playgroud)
小智 13
/**
* Happy Javadoc haiku:
*
* Without Javadoc
* Builds break in Maven site stage
* This fixes the build.
*/
Run Code Online (Sandbox Code Playgroud)
TM.*_*TM. 12
实际上前几天看到了这个问题,有些代码是在截止日期之前写的.
//This was clearly written under duress
Run Code Online (Sandbox Code Playgroud)
edo*_*aur 12
// Added because boss changed his mind : 20020111,20020501,20020820, ...
// Commented out because boss changed his mind : 20020201,20020614,20020908, ...
Run Code Online (Sandbox Code Playgroud)
在大多数被黑客攻击的RPG数据库和SQL Server数据库之间的ETL脚本中.我有10或20次发表此评论的内容......
Ove*_*own 12
我想我有这样的东西:
if (case1) { // trivial
...
}
else { // we are screwed
/* fill in later */
}
Run Code Online (Sandbox Code Playgroud)
好吧,所以我可能会使用比拧紧更强的词
Ric*_*ett 12
在某些汇编程序中,在包含的行的末尾 &h723
' RIP LVB
Run Code Online (Sandbox Code Playgroud)
(得到它?)
Pra*_*are 12
/**---------START-----------**/
// IMPLEMENTATION GOES HERE
/**---------END-----------**/
Run Code Online (Sandbox Code Playgroud)
但没有代码;)
use*_*503 12
// this error could never happen
Run Code Online (Sandbox Code Playgroud)
然后 - 客户的电话说他看到一条错误消息"此错误永远不会发生"
小智 12
我最喜欢的评论是我的一个同性恋朋友使用的.他喜欢在VB.NET中标记他所有的TODO评论
'TODO: Matt Damon
Run Code Online (Sandbox Code Playgroud)
有时提供了额外的信息,但通常不提供.
Ste*_*roy 12
当我在Highschool参加CS课程时,我们在普通教室里接受教育 - 没有电脑.我们所有的测试都是在我们递交的纸上完成的 - 每张纸一个类.我们的老师第一次用C++教课,偶尔会在黑板上切换到Pascal模式.这很尴尬,因为我们很少有兴趣学习Pascal.
对于大于课堂的工作,我们会在家里完成这些工作,并提交代码+输出打印输出进行评分.在提交了一些代码+输出打印输出之后,我们共同意识到老师实际上并没有阅读代码 - 只是打印输出.为了测试我们的理论,我对我的代码的第3页进行了评论 - 在某些类声明之间:
// If you are reading this, please place a checkmark here [ ]
Run Code Online (Sandbox Code Playgroud)
当然,我在前面拿了一个大的蓝色"A",没有找到勾选标记.
小智 12
rescue
# silently, we fail
# many validations fade
# like tear drops in rain
end
Run Code Online (Sandbox Code Playgroud)
这只是其中之一......
小智 12
'Mind boggling, gibberish version of a SQL statement, but it work's, so dont touch it
Run Code Online (Sandbox Code Playgroud)
小智 12
在makefile中找到了这个
# ===== Never edit below this line. Ever. Or I'll kick your ass. ====
Run Code Online (Sandbox Code Playgroud)
rsh*_*oda 11
当我实现原型变成真正的代码时,这实际上是由我做的:
// Abandon all hope you who needs to debug this
Run Code Online (Sandbox Code Playgroud)
是的,比我聪明的人事后重构了代码(它必须有一个好的结局).
And*_*dré 11
在XSLT文件的标头中:
DON'T TOUCH THIS SCRIPT -> XSLT is like arcane, black magic
Run Code Online (Sandbox Code Playgroud)
小智 11
这里有很多好的......
这些都是linux中的评论
http://lwn.net/1998/1015/a/f-word.html
我最喜欢的:
./arch/sparc/kernel/ptrace.c
/* Fuck me gently with a chainsaw... */
./drivers/scsi/qlogicpti.h
/* Am I fucking pedantic or what? */
Run Code Online (Sandbox Code Playgroud)
Joh*_*man 11
不是代码注释,而是SVN对同一文件提交注释:
第一次提交(在测试人员返回结果后跟随其他几十个人):
Squashed some IPR mod bugs. The were big and juicy ones, too.
Run Code Online (Sandbox Code Playgroud)
第二次提交:
Squashed some more mod bugs. Those are some nasty bugs, them mod bugs...
Run Code Online (Sandbox Code Playgroud)
第三:
Squashed some more mod bugs. They are like cockroaches: they'll live through a nuclear war.
Run Code Online (Sandbox Code Playgroud)
第4名:
Squashed some more John bugs. They too are like cockroaches: they appear anywhere John goes. Wait. That doesn't sound right.
Run Code Online (Sandbox Code Playgroud)
第五名:
Same John bug. It didn't die, just played 'possum.
Run Code Online (Sandbox Code Playgroud)
是的,我厌倦了"修复bug".
Joh*_*itb 11
我喜欢GNU binutils中的一些注释.这个来自BFD som.c:
/* You'll never believe all this is necessary to handle relocations
for function calls. Having to compute and pack the argument
relocation bits is the real nightmare.
If you're interested in how this works, just forget it. You really
do not want to know about this braindamage. */
Run Code Online (Sandbox Code Playgroud)
这个也是:
/* Don't ask about these magic sequences. I took them straight
from gas-1.36 which took them from the a.out man page. */
Run Code Online (Sandbox Code Playgroud)
...
/* Keep track of exactly where we are within a particular
space. This is necessary as the braindamaged HPUX
loader will create holes between subspaces *and*
subspace alignments are *NOT* preserved. What a crock. */
Run Code Online (Sandbox Code Playgroud)
另一个:
/* We will NOT put a fucking timestamp in the header here. Every
time you put it back, I will come in and take it out again. ... */
Run Code Online (Sandbox Code Playgroud)
从天然气:
/* Yes this is ugly (storing the broken_word pointer
in the symbol slot). Still, this whole chunk of
code is ugly, and I don't feel like doing anything
about it. Think of it as stubbornness in action. */
Run Code Online (Sandbox Code Playgroud)
Tim*_*ost 11
我猜它有病毒,我在守护进程(Linux)中发现以下内容阻止OOM杀手选择它:
/*
* Don't OOM me, bro!
*/
Run Code Online (Sandbox Code Playgroud)
这是在mlockall()之后,以防止进程交换,评论说:
/*
* Don't swap me, bro!
*/
Run Code Online (Sandbox Code Playgroud)
Boy*_*ski 11
我最喜欢的(我必须承认我曾多次使用过):
// Yes...I know this is repulsive and stupid.
// But <%CompanyOwnerOrManagerToken%>, not knowing a thing about code,
// demanded I do it anyways. SO, go crap on their desk, not mine.
// K THX BYE
Run Code Online (Sandbox Code Playgroud)
Jor*_*orn 11
/* FIXME This must absolutely be removed before 4.0.7 release
* TODO really remove this */
Run Code Online (Sandbox Code Playgroud)
我们发布了4.0.7,4.0.8,4.0.9和4.1版本......
小智 11
我曾经参与过一个项目,在那里我发现了这个评论:
// Cabbage fart?
Run Code Online (Sandbox Code Playgroud)
我不知道它应该是什么意思.很高兴我的立方体不在谁写的旁边.
小智 11
/* Here I sit, Joe broken hearted, came to do some sh*t, but only just started. */
Run Code Online (Sandbox Code Playgroud)
关于一些繁重的正则表达式输入验证.
小智 11
public function get state( /* of Palestine back */ ):Boolean
Run Code Online (Sandbox Code Playgroud)
小智 11
v.bpc := v.pc; -- Remember to jump back
v.baccu := accu; -- Yo dawg, heard you like runing instructions
-- so I took backup of your accu so you can run
-- instructions while you run instructions.
v.flags.i := false; -- No more interupts
Run Code Online (Sandbox Code Playgroud)
小智 11
在完全任意行之后的几千行JScript文件中间......
// The world is a happy place.
Run Code Online (Sandbox Code Playgroud)
Tim*_*ost 11
好吧,这是我刚刚承诺的一个:
/* Every time I re-visit this function, I feel like
* I need to take a shower.
*
* Don't get too used to this function, its days are
* numbered.
*/
Run Code Online (Sandbox Code Playgroud)
有人可以像greatcodecomments.com一样开始赚钱.然而,那个人不是我.
Mao*_*gue 11
// Singleton object. Leave $me alone.
private static $me;
Run Code Online (Sandbox Code Playgroud)
小智 10
THIS PROGRAM HAS CODE THAT DOES NOT MEET STANDARDS
Run Code Online (Sandbox Code Playgroud)
这个评论几乎在我们这里的每个项目......
Enr*_*lio 10
在JUnit API中找到:
/**
* ...as the moon sets over the early morning Merlin, Oregon
* mountains, our intrepid adventurers type...
*/
public Test createTest(Class theClass, String name) {
...
}
Run Code Online (Sandbox Code Playgroud)
bel*_*bob 10
在LucasArts的电脑游戏"The Eidolon"的源代码中看到了(这本身就是奇怪和古怪的)......
// He's dead, Jim!
Run Code Online (Sandbox Code Playgroud)
Ric*_*ner 10
// TODO - Comment this function
Run Code Online (Sandbox Code Playgroud)
Chr*_*ssl 10
我不记得确切,但这个想法是这样的:
Person p = new Person("John", "Doe", "male");
Collection women = new ArrayList();
women.insert(p.getTail());
Run Code Online (Sandbox Code Playgroud)
这是脏代码;)
Jos*_*hua 10
'Do not optimize these next two lines. Compiler bugs lurk.
Run Code Online (Sandbox Code Playgroud)
他们做到了.将变量压缩到第二行的表达式中导致跳转到堆的中间并尝试执行数据.
jpi*_*912 10
从一个明显一直在看Monty Python的小伙子:
Run Code Online (Sandbox Code Playgroud)> // And now, for something completely > // different:class theLarch {
bla*_*ank 10
// fix for groupid > 9
// if groupid ever gets to 100 everything will break (again)
if (groupid < 10) {
groupid = "0" + groupid;
}
Run Code Online (Sandbox Code Playgroud)
Ada*_*mBT 10
今天刚刚添加了这个:
// Hardcoded this for time sake ... will make andrew fix later :)
Run Code Online (Sandbox Code Playgroud)
Pol*_*olo 10
这条评论来自我必须调试的旧项目:
//Haleluya i can go home!
Run Code Online (Sandbox Code Playgroud)
Chr*_*ett 10
在我决定用脚本语言替换它之前,我不得不将这个添加到旧的数据表驱动的规则引擎中.
/************************************************************
* *
* .=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-. *
* | ______ | *
* | .-" "-. | *
* | / \ | *
* | _ | | _ | *
* | ( \ |, .-. .-. ,| / ) | *
* | > "=._ | )(__/ \__)( | _.=" < | *
* | (_/"=._"=._ |/ /\ \| _.="_.="\_) | *
* | "=._"(_ ^^ _)"_.=" | *
* | "=\__|IIIIII|__/=" | *
* | _.="| \IIIIII/ |"=._ | *
* | _ _.="_.="\ /"=._"=._ _ | *
* | ( \_.="_.=" `--------` "=._"=._/ ) | *
* | > _.=" "=._ < | *
* | (_/ \_) | *
* | | *
* '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=' *
* *
* LASCIATE OGNI SPERANZA, VOI CH'ENTRATE *
*************************************************************/
Run Code Online (Sandbox Code Playgroud)
dan*_*nio 10
// Some wanker in ISO got rid of ifstream(int), ofstream(int), and
// fstream(int). Twit.
Run Code Online (Sandbox Code Playgroud)
小智 10
/**
* Not even your mum thinks you're special if you call this method
*/
onlyYourMumThinksYoureSpecialIfYouCallThisMethod() {...}
Run Code Online (Sandbox Code Playgroud)
小智 10
从UNIX版本6源代码,大约1975年:
/* You are not expected to understand this. */
Run Code Online (Sandbox Code Playgroud)
Jas*_*son 10
// Fuck.
Run Code Online (Sandbox Code Playgroud)
那个,......
// This code worked before, but my cat decided to take a trip across my keyboard...
Run Code Online (Sandbox Code Playgroud)
# absolutely foul heuristic code.
# ..it's dirty, but you want it.
Run Code Online (Sandbox Code Playgroud)
和:
# VERY USEFUL DEBUGGING AID, for when the above all goes pearshaped:
Run Code Online (Sandbox Code Playgroud)
小智 9
不是评论,而是属性
[ThereBeDragons]
Run Code Online (Sandbox Code Playgroud)
我在IHttpHandler的实现中看到了一个
//What is this?
public bool IsReusable
{
get{return false;}
}
Run Code Online (Sandbox Code Playgroud)
这是我自己的代码中的一个,但它仍然非常有趣,我想我也可以把它放在一起,因为它是在公共SVN中.
// These were orginally up and down. When it was clear the names were
// inapplicable, they were renamed to retain the joke.
// Sorry if you were hoping for useful variable names.
quantum strange, charm;
Run Code Online (Sandbox Code Playgroud)
public int hashCode() {
//sucks, but what're you gonna do
/*
int hash = 7;
for (int i = 0; i < array.length; i++)
hash = hash * 31 * (null == array[i] ? 0 : array[i].hashCode());
return hash;
*/
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在调试别人的JavaScript时,我看到了以下评论:
// Notice: I feel so dirty doing this, but it's the only way to make it cross browser.
Run Code Online (Sandbox Code Playgroud)
但在阅读Scott Hanselmen的一篇文章时,我发现了以下引用,这与我在代码中找到的评论非常相符:
Every line of code you write that you feel gross about will ultimately come back to haunt you. Therefore, avoid writing code that makes you feel dirty.
Run Code Online (Sandbox Code Playgroud)
那很好笑 :)
这是我最喜欢的评论.
/// I intend to do this as shittily as possible because there are many better products that will totally blow this out of the water
/// and we don't have them so whatever
Run Code Online (Sandbox Code Playgroud)
稍后在文件中我们会有更多的乐趣
/// sidestep a bug in WCF (that we can't send types across)
/// or, depending on how you look at, this issue is a Feature
Run Code Online (Sandbox Code Playgroud)
再来一次
if( where == null)//be nice
Run Code Online (Sandbox Code Playgroud)
在一家大型投资银行中,我需要记录并评论所有应用程序中断
Without a crash
Or mighty bang
The sync disk
Did it's process hang
Run Code Online (Sandbox Code Playgroud)
catch (Domain.ConcurrencyException)
{
// somebody changed it between the time we loaded it and now.
// weird, huh?
}
Run Code Online (Sandbox Code Playgroud)
我刚刚在一个非常简单的测试C++程序中遇到过这个问题,这个程序适用于大学课程.
我正在评论一堂课.
在析构函数中......
// Choose! Choose the form of the Destructor!
// The choice is made! The Traveler has come!
Run Code Online (Sandbox Code Playgroud)
我在查看TVNZ网站早期版本的HTML源代码时发现了这个宝石(如果你在家里玩的话,从第571行开始):
<!-- Hopfully we can do this otherwise the nav is going to be pretty plain and Hong will go postal. -->
Run Code Online (Sandbox Code Playgroud)
// TODO: Drive an ashen stake through the foul heart of this function.
Run Code Online (Sandbox Code Playgroud)
这是一个犯规功能.到目前为止,我一直都在做噩梦.
好吧,这些都是我的,所以WTF就是我,正如CodingHorror所说:
//#region Code for weird cases - do you really want to know?
Run Code Online (Sandbox Code Playgroud)
我曾经在一些ASP中留下了这样的评论:
' Commented out following code, don't delete for when [CustomerName] changes his mind
Run Code Online (Sandbox Code Playgroud)
碰巧,[客户名称]并未改变主意,但他无法访问网络服务器,他发现该行...
// This condition can't happen. Call the police or something.
Run Code Online (Sandbox Code Playgroud)
小智 8
var arbitraryNumber = 10;
//I don't know why. Just move on.
Run Code Online (Sandbox Code Playgroud)
我在Google Code Search上找到了这个
// Constructs a tuple with 2 elements (fucking idiot, use std::pair instead!)
template <typename T0,typename T1>
inline tuple <T0,T1> make_tuple (const T0& t0,
const T1& t1) {
tuple <T0,T1> t;
t.get<0>() = t0;
t.get<1>() = t1;
return t;
}
Run Code Online (Sandbox Code Playgroud)
// TODO: not this
Run Code Online (Sandbox Code Playgroud)
由同事在一个查询之上写下,迫切需要优化.在他的辩护中,我们在这一点上工作了70个小时,持续了几个月......
小智 8
/*
____________________
/ \
| Jean-Michel Bechet |
| 2002-2009 |
\___ _______________/
|/
(o_
//\
V_/_
*/
Run Code Online (Sandbox Code Playgroud)
// This part is more difficult
Run Code Online (Sandbox Code Playgroud)
在方法的顶部.
这大约是5行.
并不是很困难.
这是唯一的评论.
在整个应用程序中.
小智 8
/**
* This run through all the guipublisherbuyRecord , the records those have
* diff. is buytotal and prior to buy isRecommendedBillingClickedWarning flag
* is set if priously RB ran and this time not.
*
* --What?
*
* @return
* @throws AppException
*/
Run Code Online (Sandbox Code Playgroud)
小智 8
//Dave chapelle reports errors.
function reporterror() {
davechapelle.trace("FUCK!");
}
Run Code Online (Sandbox Code Playgroud)
小智 7
我在重新使用我在很久以前写过的PHP类时发现了这一点.我仍然不记得那里去了什么,我仍然没有找到它...我实际上甚至不记得我写的评论; 所以当我找到它时,我大声笑出声来.
try
{
// Some database logic
}
catch (Exception $ex)
{
// sure, it looks silly and I honestly cant remember what code used to go here... but i swear i will
// find a use for this code.... eventually....
throw $ex;
}
Run Code Online (Sandbox Code Playgroud)
在一个文件中的5000多行代码中的一些极少数评论
我实际上与编码者辩论他的编码风格...
没有评论!
并且没有评论;-)(或很少)
遗憾的是这是生产代码.
offset=1;
for (i=0;i<=len;i++)
{
if ((i!=0)&&(i<len)) //-3
{
switch(mess[i])
{
case ETX:
case ETB:
case DLE:
buf[offset]=DLE;
offset++;
break;
}
}
buf[offset]=mess[i];
offset++;
}
Run Code Online (Sandbox Code Playgroud)
我喜欢这个开关!
for (n=0;n<offset;n++)
{
Sleep(TR); //Modif A
Sleep(T);//
FWriteFile(hCom,buf+n,1,&dwMot,NULL);
if (ECHO)
FReadFile(hCom,tab,1,&dwMot,NULL);
}
Run Code Online (Sandbox Code Playgroud)
并且没有,没有评论解释标题中的"modif A".
if (GetFileSize(hSlotFile,NULL)==3600) //5*720
Run Code Online (Sandbox Code Playgroud)
什么是720?
在为某个芬兰移动网络设备制造商工作时,通过硬件抽象层进行探索,我发现了100多个芬兰语单词"puukko".
"puukko"是每个芬兰人在他们的工具箱或房子周围都有的通用刀.它用于从剥土豆到进行电脑维修(我的观察)的一切.我相信在这种情况下,芬兰语相当于"哈克"这个词.
我的芬兰同事否认了这一点,并表示这意味着更像"外科手术/干预"......我几乎相信它们,直到我发现评论为止:
/* Perkele ISO Puukko! */ -> Fucking Big Hack!
Run Code Online (Sandbox Code Playgroud)
小智 7
不是评论:
DvLog::Log("This silly log message fixes a PSCRIPT5.DLL gpf when printing to Adobe.");
Run Code Online (Sandbox Code Playgroud)
可悲的是,没有评论,PSCRIPT5.DLL确实爆炸了......
小智 7
// WARNING!!!
// Very perversive code ahead!
... about a 20 lines of "very perversive" code ...
// Now you can call your grandmother back. ;)
Run Code Online (Sandbox Code Playgroud)
在LKM中:
/*
* Dear Richard Stallman,
*
* This one's for you.
*
* Sincerely,
* Me
*
*/
MODULE_LICENSE( "GPL" );
Run Code Online (Sandbox Code Playgroud)
我最近看到了这个:
//你刚丢了游戏
如果你不知道游戏是什么:http: //en.wikipedia.org/wiki/The_Game_ (mind_game)(它非常愚蠢,但在某种程度上有点愚蠢)
我在一个显式奇怪的强制转换函数FULL中看到了这段代码:
// Since today's CPUs are really fast, this is dedicated to those who said:
// " You can't use Moore's Law as an excuse to write bad software. "
Run Code Online (Sandbox Code Playgroud)
代码很可怕:)
在我们的应用程序中首次重新编译FreeTextBox3,因为我们需要IE8支持......看看我发现了什么:
// IE7 update. this is still bad code, but IE8 is probably a long way off :)
Run Code Online (Sandbox Code Playgroud)
小智 7
# dont question, i just felt like throwing some globals in
# this is actually quite pointless as youll soon see
Run Code Online (Sandbox Code Playgroud)
稍后在代码中
#draw the circles (complicated)...dont question
Run Code Online (Sandbox Code Playgroud)
甚至更晚......
# complicated process of drawing the circles in a
# somewhat symmetrical, 3-d pattern
# dont question again
Run Code Online (Sandbox Code Playgroud)
甚至以后......
# will determine if user clicks on die
# i determined these values...dont worry about them
Run Code Online (Sandbox Code Playgroud)
刚从大学毕业,我急于弄脏自己的手.我的第一个任务是......"为我评论这段代码".
笨蛋.
过了一会儿我厌倦了......
// this function doesn't actually calculated the profit, like it says --it really signals the mothership orbiting saturn that the planet is ripe for takeover
[later]
// I don't think anyone is going to read this
[various permutations on that last one]
Run Code Online (Sandbox Code Playgroud)
-- Change Log: Not needed. The code is perfect 'cause I wrote it.
-- If you change it, it will break.
Run Code Online (Sandbox Code Playgroud)
我正在审查一些代码注释以检查它们是否有意义,并且看到了上面的适度行.
在被迫为贫血域对象编写单元测试时,这些对象只不过是一堆吸气剂和固定器(我也被迫写入):
// zzzzZZZZzzzz....
Run Code Online (Sandbox Code Playgroud)
Case 1:
...
break;
...
//I don't want do do this but [my coworker] says it's part of the code standard
default:
break;
Run Code Online (Sandbox Code Playgroud)
<!-- THIS IS THE MAIN CONFIGURATION FILE FOR THE ENTIRE BLOODY DIRECTORY -->
<!-- WHATEVER YOU DO, DO NOT EDIT THIS FILE WITHOUT TALKING TO ME FIRST -->
<!-- I'M SERIOUS -->
<!-- (scroll down) -->
Run Code Online (Sandbox Code Playgroud)
我不再拥有确切的代码包了,但我清楚地记得这个评论.
// The code below needs to be changed immediately.
// I wish I was a little bit taller
// I wish I was a baller
// I wish I had a girl who looked good, I would call her.
Run Code Online (Sandbox Code Playgroud)
从C#中的单元测试类:
#region quis custodiet ipsos custodes?
[Fact]
public void TestPositive()
{
Assert.Equal(4, 2 + 2);
}
[Fact]
public void TestNegative()
{
Assert.Equal(5, 2 + 2);
}
#endregion
Run Code Online (Sandbox Code Playgroud)
// I love the smell of dirty XML in the morning
xml = xml.Replace("xmlns=\"urn:bsd.orion/inventory\"", "");
Run Code Online (Sandbox Code Playgroud)
我曾经研究过Windows 3.0的源代码.(不是,我赶紧补充一下,作为一名微软员工!)我遇到了一个多次重入的文件加载器,并且有一个令人讨厌的惩罚的例子(只是为了表明作者有多聪明).
这一堆重入代码是用英特尔汇编jmp指令(在C代码中间)执行的,该指令进入标签"we_are_not_in_kansas_any_more_toto".
#ifdef TRACE
#undef TRACE /* All your trace are belong to us. */
#endif
#define TRACE ....
Run Code Online (Sandbox Code Playgroud)
整个功能非常棒(来自Linux sunhme.c驱动程序,因为Sun的昵称为Happy Meal的网卡.因为之前出现的卡是"Big MAC".获取它?获取它?)
static void happy_meal_tcvr_write(struct happy_meal *hp,
void __iomem *tregs, int reg,
unsigned short value)
{
int tries = TCVR_WRITE_TRIES;
ASD(("happy_meal_tcvr_write: reg=0x%02x value=%04x\n", reg, value));
/* Welcome to Sun Microsystems, can I take your order please? */
if (!(hp->happy_flags & HFLAG_FENABLE)) {
happy_meal_bb_write(hp, tregs, reg, value);
return;
}
/* Would you like fries with that? */
hme_write32(hp, tregs + TCVR_FRAME,
(FRAME_WRITE | (hp->paddr << 23) |
((reg & 0xff) << 18) | (value & 0xffff)));
while (!(hme_read32(hp, tregs + TCVR_FRAME) & 0x10000) && --tries)
udelay(20);
/* Anything else? */
if (!tries)
printk(KERN_ERR "happy meal: Aieee, transceiver MIF write bolixed\n");
/* Fifty-two cents is your change, have a nice day. */
Run Code Online (Sandbox Code Playgroud)
}
这是我们在大学的宿舍中使用的自定义DHCP服务器,将计算机放入"干净"或"脏"的IP地址池,具体取决于他们是否注册/安装了补丁和防病毒软件:
public boolean getDirty (String MAC) // not as fun as it sounds
Run Code Online (Sandbox Code Playgroud)
小智 6
// TODO: what the hell is this all about?
Run Code Online (Sandbox Code Playgroud)
然后一些注释掉的代码.
这在我们今天早些时候的工作代码中找到了.我不确定我是应该笑还是哭...
{
This is a gathering place for all unit tests.
Create a TUnitTestWrapper, then call "RunAllUnitTests".
This class will create an instance of each thing to be tested, and call each of
their unit tests.
It does not really do any testing on it's own; it just gives a common place from
which to call everyone else's tests.
This way, one day, we can automate our testing with each build. [Cue laughter]
}
Run Code Online (Sandbox Code Playgroud)
struct core_unlocker
{
core_unlocker(lock)
{
m_lock = lock
unlock(lock) //Abandon All Locks, Ye Who Enter Core!
}
~core_unlocker()
{
lock(m_lock)
}
private:
Corelock m_lock;
}
Run Code Online (Sandbox Code Playgroud)
在名为"Bar"的类(具有少于描述性名称的UI控件)中,类标题:
/// <summary>I pity the "foo".</summary>
Run Code Online (Sandbox Code Playgroud)
和Remove()方法:
/// <summary>A "foo" and his money are soon parted.</summary>
Run Code Online (Sandbox Code Playgroud)
更糟糕的是,它是一个商业合作伙伴,从生成的文档中指出了它.更糟糕的是,这些可能是我们从这个人那里获得的有用文档最接近的东西.
来自C#
#region Hack - Shield Eyes Before Expanding
/// <summary>
/// A single uint with all of the bits set to represent the different tracing
/// </summary>
/// <remarks>
/// Ugly I know, so if you can think of a better way, feel free to rewrite.
/// </remarks>
[Browsable(false)]
public uint TraceBitfield
{
// Snip
}
#endregion
Run Code Online (Sandbox Code Playgroud)
小智 5
很久以前我遇到了一些连接脚本,虽然我不记得语法,但我记得这些评论,因为我是Pink Floyd粉丝.
//Attempt Handshake: Hello? This is London calling. Are we reaching you?
//Handshake Failed: I don't understand...he just hung up.
Run Code Online (Sandbox Code Playgroud)
解码的可怕补丁(意大利语翻译):
/**
*@return the value
*@param key: the id of the list of instruments
*@PS this function is a violation of all the laws of the
*software engineering,
*commons sense, highway code
*and ONU decision about the coding.
That sh*t...
*/
Run Code Online (Sandbox Code Playgroud)
那是众所周知但我喜欢它(在sys/ufs/ufs_vnops.c中):
/*
* A virgin directory (no blushing please).
*/
Run Code Online (Sandbox Code Playgroud)
在FreeBSD内核源代码树中(甚至在之前,回到4.xBSD)
刚刚在我们的一些PHP代码中找到了这个
$s=2; // chicken and bacon wrap for lunch
Run Code Online (Sandbox Code Playgroud)
多么有用,幸运的是$ s是自我解释的
try {
doSomething();
} catch(err) {
// Die quietly
alert(err);
}
Run Code Online (Sandbox Code Playgroud)
小智 5
我刚刚在自己的一些代码中遇到了这个问题.它是用于选择类别的magento管理模板:
/*
* OK; before you read the following code know what I am trying to do.
* I needed to get the list of child catagories from the root node so that
* the root node didn't appear in the selection box. But for some stupid
* fucking reason the stupid fucking DBA wont let me access the items using
* indicies and I instead have to use their stupid fucking Iterator
* implementation. So there.
*/
$firstList = $this->getRootNode()->getChildren();
foreach ($firstList as $node)
{
$nodes = $node->getChildren();
break; // wtf?
}
Run Code Online (Sandbox Code Playgroud)
我将删除我们的旗舰产品当然的语言; 但我记得我非常沮丧.如果我没有发表评论,我会尝试修改它,但后来遇到了我以前遇到的相同问题.
这比您在许多评论标题中看到的可怕的法律声明和免责声明要好得多.来自SQLite.
/*
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
*/
Run Code Online (Sandbox Code Playgroud)
小智 5
设法将这个坏双关语插入到我们的代码中
for (bo_thans = 0 ; bo_thans < MAX ; bo_thans++)
{
if(rs == thing[bo_thans])
{
found = true;
}
}
if(!found)
{
/* Failed to find rs with bo_thans */
...
}
Run Code Online (Sandbox Code Playgroud)
来自英国银行申请的承包商.
// i don't know how this works but it does so i'll leave it here anyway
Run Code Online (Sandbox Code Playgroud)
他还将BNP(英国非常右翼派对)作为测试中的一个虚拟客户添加...我们的直接老板是亚洲种族.
<!-- Here it is -->
Run Code Online (Sandbox Code Playgroud)
没有其他评论.直到今天,我还不知道"它"是什么.
小智 5
我没有共享的代码,但想象一下这种情况.在Linux系统管理员离开绿色牧场后大约一两个月,我有幸打开了他写的shell脚本.我不记得为什么我需要编辑它,但这不重要.重要的是剧本大约有40行.我滚过评论(其中有37行)以达到实际工作代码(3行).代码很棒,但我很好奇 - 为什么有37行评论?所以,我滚动到顶部继续阅读.令我惊讶的是,评论是关于三行代码的作用以及如何改变它的说法.最好的部分 - 这是由Dr. Dre和Snoop DO DOUBLE G部分取消了Nothing But AG Thing.感谢Brian!
/*
* TODO: Remove this function
function remove($customer_id)
{
$this->Customer->remove($id);
}
*/
Run Code Online (Sandbox Code Playgroud)
我个人最喜欢的是利默里克形式的文档:
Subclassing made Zope and TR
much harder to work with by far.
So before you inherit,
be sure to declare it
Adapter, not PyObject*
Run Code Online (Sandbox Code Playgroud)
这可能会破坏这个笑话,但由于它有点模糊,我会解释:
"TR"在这里指的是"扭曲的现实".Zope 2和原始twisted.reality软件包广泛而不幸地使用了多重继承,这使得在看到方法调用时很难理解发生了什么.Zope 3,Twisted本身,以及其twisted.reality继承者(包括最近的,Imaginary)反而普遍赞成组件组合.
/**
* As Gregor Samsa awoke one morning from uneasy dreams he found himself
* transformed in his bed into a gigantic insect. He was lying on his hard,
* as it were armour plated, back, and if he lifted his head a little he
* could see his big, brown belly divided into stiff, arched segments, on
* top of which the bed quilt could hardly keep in position and was about
* to slide off completely. His numerous legs, which were pitifully thin
* compared to the rest of his bulk, waved helplessly before his eyes.
* "What has happened to me?", he thought. It was no dream....
*/
protected static String DEFAULT_TRANSLET_NAME = "GregorSamsa";
Run Code Online (Sandbox Code Playgroud)
小智 5
catch
{
// you’re fucked
// write out the file somewhere and start screaming “Connection down! Connection down!”
}
Run Code Online (Sandbox Code Playgroud)
小智 5
很多年前,我接受了这项工作,为一个在Z80上实时运行的项目提供支持,并且正在组装(有没有其他方法可以做Z80?)无论如何,原作者是一个名叫尼日利亚的人.摩西.也许我应该就此止步.无论如何,分散在整个代码中的是:
XRA A ;MT
Run Code Online (Sandbox Code Playgroud)
我花了一段时间才弄明白这是什么.指令本身只是清除累加器.这是一个光滑的方式,虽然我不确定是否有优势.你可以这样做:
LDA 0
Run Code Online (Sandbox Code Playgroud)
但也许吧
XRA A
Run Code Online (Sandbox Code Playgroud)
保存一个字节或其他东西.什么是独占或累积器本身.结果当然总是为零.
回到MT - 空(得到它?)
这是我遇到的最好的.
""".........................:~+?7$$$ZZZZZZZ$$$7I+=:,............................
........................~+7ZZZZZOZZOOZOZZOZOZOOZZZZZ7?~:........................
......................,~7$ZZOOOOOZOZOZOZZOOZZOZOOOOOZ$$I,.......................
...................,=I$OOZOZOZZOOOZZOZOOOOZOZZZOOZZZOZZOZI=:....................
.................:?$ZZOOZZOZOZZOOOZZZOOZOZOZZZZZZZOZZOZOOOZ$I~..................
................IZOOOZOOOZZZOZZZZOZZOZOOOOZOZZZOOZZZZOOZOZZZOZ7=................
...............~ZZOZZOZOOZOOZOZOZZOZOZOZZZZZOZOZZOZOOZOZZOOOOZZ7................
.............:IZOOZOZZZZOZOZZOZOOZOZOZOZZOZOOZOOOOZOZZZZZOZOZZOOI~..............
...........,+$ZOOZZOZOZOZOZOZZOZOZOOZZOZZOZZOZOOOOZOZZOZZOOZOOOOO$?:............
..........:IZZOOOZOZZZZOOZOOZOZOZZOZOZZZZOZOOZOZZOZOZOZOOOOOOOZZZOZ7~...........
..........+$OOZZZOZZOOZOOZZZZOZZOZOZZOZOOOZOZOZZOZOZOZOOOOOZ$$77I77$+:..........
........,?$OOZZZZZZZOZOOOZOZZOZZZOOZOZOOOOZOZZZOOZOOZOOO7?~:,.......,...........
........+ZOOZZZZZOZOOZOOZZZZOZZOOOZZZOZOZOOZZOZOZZZOOO$?........................
........$ZOZZZOZZZZOZOOZZZOZOZZOOOOOOOOOOOZOZOZZOZOO$?,.........................
.......:ZOOZOZOZZOOZZOZOZOZOOOZOOOOOOOOOOOOOOOZOZOOZI:..........................
.......+OOOZOOZOZOZOZZZOOZOOZOOO$I+=~:::~+I$OOOOOOZ?:........,:=,...............
......:7ZOOZOZZOOOZOZOZOOZOOZ$I=............:?$OOZ7:.......:IZOOZ?,.............
......=$OZOZOOZOOOOOZOZZOOZ7=,................:?O$+.......~7OOOOOZ+,............
.....,?$OOOOOZZZZOOOOOOZOZ?,....................ZZ=.......=$OOZOOZ+,............
.....:IZOZZ$777I7$ZOOOOOZ7~.....................$Z=.......~7OOOOO7=.............
.....:+?~:,.......,~IZOO7~........~+II?=........?$?,.......:I$ZZ?:..............
.....................+ZO=,......:IOOOOOZ:.......=7$~............................
.....................:IO~.......=OOZOZOO=,......~7O7~...........................
...........:~:.......:IO~.......+OOOOZOO=.......~78Z?,.................,:.......
..........:IZ7~......+ZO~.......:7OOOOO$,.......+$OOZ7=,.............:?$=.......
...........,,.....,=7ZOO+,.......,=II?=:........7OOOOOOZ=:,.....,:=I$ZOO=.......
....................,:+$7=.....................~OOOZZZOOOZZ$$7$$ZOOOOOOZ=.......
......................:?Z?,...................:?OZOOZOOZOOOOOOOOOOZOZOZO=.......
............,::,.......,OO7:................,+$OOZOZOOZOZZOZOZZOOZOZOZOO=.......
...........~$8OI........$OOZI~,.........,:=IZOOZOZOZOZOOOZOZOZOOOZZZOZOO=.......
...........:??=:.......:OOOOOZZ7+=~~==+?$ZOOOOZOOOZOZOZOOZOZOZZOZZOZOZZO=.......
............::,.......,+OOZOOOOO$7777$$ZOOOOOZOZZZZOZOZZZOOZOZZOOOZOOZOO=.......
.....................=7OOZOOZOOZOOOOOOOOOZZZOZOZZOZOZOZOOOZOZOZZOZOOZOOO=.......
................,:=I$OOOZZOOOZOOOOOZOZOZZZZZOOZZZOZOZZZOOZOOZOZOZOZOZOOZ=.......
...........:~+?7ZOOOOOOZZZOZOOZOZOOZOZOZZOZZOZOZZZZOZOZZOZOZOZZOZOOZOOOZ=.......
........$$ZOOOOOOOOZOZOZZZZOZOZOOOZZZOZZZOZOOZOZZZZZZZZOOOZOOZZZOZOOZOOZ=.......
.......~OOZOOZZOOZZZZZZOOZOZOZOZZOOZOOZZZOZZOZOZZOZZZOZOOOOOZOZOZOOZOOOZ=.......
.......~OOZOOZZOZZOZOZZOZZOZOOZOZOOZOZOZZOZOOZOZZOZOZOZOZOOZOZOOOZOOZOZO=.......
.......~OOZZZOZOOOZOZOZZOZOZOZOZOOZOOZOOOOZOZOOZOOOZOOOZOZZOZOZOOZZOOOOZ=.......
.......~OOZZOZOZZZOOZOOZOZOZOZZOZZZZOZZZZOZOZZOOOOZ$ZZZZZZOZZZOZZOZOZZZO=.......
.......~OOZZOO$??$OOZOOZZOOZOZOZ+~IZOOOZOZOOZZOOZI==IZOZZOZOOZOZZOZI~=7O=.......
.......~OOZO$I:..~IZZZOZOZOZOZ$+...=7ZOOZOOZZOZZ=,..,=$ZZOZZZZZOZI~...,?=.......
.......~OOOZI:....:IZOOOZZOOO$+:....~7ZOZOZOZOZ$,....,=$OOZOOOZOI~.....:~.......
.......~OZI~........~IZZZOZ$?:........=IOOZZZ$+,.......,$ZOOOZZ7................
.......=7~............~IOZI:............7ZO$+:..........,=7ZZ7=,................
.......,,...............=~...............~=:..............,~=...................
GlassGiant.com"""
print "Hello World!"
Run Code Online (Sandbox Code Playgroud)
小智 5
/* This is a replica of a horrible hack - many moons ago, the legacy PortfolioServer was modified to return cash trades in an "optionTrade" block, because the client side developer was too lazy to get their XPaths right. Their laziness echoes through the ages, and means we need a similar hack here...*/
小智 5
//Time log says you've been here for 15 hours GO HOME, your code is hobo
Run Code Online (Sandbox Code Playgroud)
小智 5
我们有一个小组项目,使用Min-Max树创建Connect 4 AI.在我们的移动评分功能中,我们计算了电路板的分数,并且在该代码块之上有以下评论:
// This is kind of almost useless
Run Code Online (Sandbox Code Playgroud)
但它变得更好.我们的导师给了我们一些原始人工智能的示例代码,他留下了很好的评论:
// We also add/subtract some points based on what's going on, on the bottom
// row. (I think this is retarded, but apparently when I coded this up
// back in 1999 I didn't.)
Run Code Online (Sandbox Code Playgroud)
在一堆内容管理Web应用程序的剪切和粘贴的源代码中:
// load image 1 - JPEG 240x320
img = f1.getImage();
if (check(img))
{
load(img, Constants.JPEG_240x320);
}
// load image 2 - JPEG 128x128
img = f2.getImage();
if (check(img))
{
load(img, Constants.JPEG_128x128);
}
...
// load image 13 - GIF 256x256
img = f13.getImage();
if (check(img))
{
load(img, Constants.GIF256x256);
}
// loaded all of the f**king images
Run Code Online (Sandbox Code Playgroud)
注意:大致翻译自意大利语:-)
小智 5
// woot, global var. I havent done this for a long time.
Run Code Online (Sandbox Code Playgroud)