- 注册时间
- 2004-8-29
- 最后登录
- 1970-1-1
|
昨天晚上看《Core Java2》时看到这样一句话:Of course, while it is true that the ++ operator gives the C++ language its name, it also led to the first joke about the language. C++ haters point out that even the name of the language contains a bug: "After all, it should really be called ++C, because we only want to use a language after it has been improved." 【注】:这句话在<Chapter 3. Fundamental Programming Structures in Java>的<Operators >一节(我看的是电子版,不知道是在原书的第几页).
这句话可能有点费解,下面我们用个C(C++)程序来说明之:
/**
*FileName:fun.c
*Author : Eastsun
*Date :10/20/2006
*/
#include<stdio.h>
#define C_VALUE 90 //假设为C语言得的分数
int isCPPBetter(){
int C,CPP_VALUE;
C =C_VALUE;
CPP_VALUE =C++; //CPP表示C++的分数
return(CPP_VALUE>C_VALUE);
}
int main(){
printf(isCPPBetter()?"C++比C好":"C++不比C好");
return 0;
}
可以肯定,这个程序在C或C++编译器上编译运行的结果是一样的。
呵呵,很有趣的一件事~
ps:Just for fun. C或C++的狂热支持者不要因此有什么想法^_^ |
|