你遇到过的源代码中最好的注释是什么?
当前回答
来自: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.
其他回答
// 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.
我最喜欢的评论是我的一个同性恋朋友说的。他喜欢用VB标记他所有的TODO注释。净,
'TODO: Matt Damon
有时会提供额外的信息,但通常不是这样。
场景一:
return 0; // Happy ending
场景二:
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
);
在SJ CA拍卖业务的早期,我曾与一个名叫Rick Dorin的人合作过。他写编译器的时候,你必须整天拨弄卡片。他的错误信息之一是
错误太多……让更少的!
离开我的上一份工作,我嵌入了一些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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