玩转代码:32个有趣的代码注释

文章展示了32个富有创意和幽默感的代码注释,程序员们通过注释玩梗、吐槽,甚至绘画,使得枯燥的代码世界充满乐趣。这些不寻常的注释不仅是技术的补充,更是开发者个性的体现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


全文共3581字,预计学习时长23分钟

图源:unsplash

 

代码注释是一种用“高级”英语陈述,描述程序将要做什么的“艺术”。有人嫌它丑,也有人觉得它还蛮有用的。

 

但还有一些“闷骚”的程序猿,早已把代码注释玩儿出了花。玩梗、吐槽、画画……还有什么是他们不能做的?

下面一起来欣赏一些有趣的代码注释吧~

注意:内容很长,毫不严肃,仅供消遣!

 

i++; //increment i

 

// Magic. Do not touch.

 

return 1; # returns 1

 

return null; //Not really null

 

// sometimes I believe compilerignores all my comments

 

// I am not responsible of thiscode.// They made me write it, against my will.

 

// I dedicate all this code, all mywork, to my wife, Darlene, who //will have to support me and our three childrenand the dog once it //gets released into the public.
# To understand recursion, see thebottom of this fileAt the bottom of the file# To understand recursion, see thetop of this file
//// 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
//private instance variable forstoring agepublic static int age;
//Dear future me. Please forgiveme.//I can t even begin to express how sorry I am.
#define TRUE FALSE//Happy debugging suckers
//open lid
//take sh!t
//close lidComments for a File open, data dump, file close…
/* You are not meant to understandthis */
const int TEN=10; // As if thevalue of 10 will fluctuate...
//When I wrote this, only God and Iunderstood what I was doing//Now, God only knows
/** TODO: Remove this function
function remove($customer_id)    {       $this->Customer->remove($id);    }
*/
// I m sorry.
// drunk, fix later
// I am not responsible of thiscode.
//This code sucks, you know it andI know it.
/* Please work */

 

// I have to find a better job

 

// Joe is sorryA few hundred lineslater...// Harry is sorry too

 

Catch (Exception e) { //who cares?}

 

// IE7 update. this is still badcode, but IE8 is probably a long way off :)

 

#Christmas tree initializer     toConnect = []     toRead =   [ ]     toWrite = [    ]      primes = [     ]     responses = {}     remaining = {}

 

// Remove this if you wanna befired

 

// somedev1 -  6/7/02 Adding temporary tracking of Loginscreen// somedev2 -  5/22/07 Temporary my a
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值