过去看《More Exceptional C++》等书时,发现总会提到 comp.lang.c++ 的新闻组,曾经有段时间用 Outlook Express 去浏览,但总觉使用起来不方便。这两天无意之间发现google居然提供了能够直接通过网页去访问它的方法。推荐一下:

http://groups.google.com/group/comp.lang.c++

(其他新闻组也可以通过类似的方式访问到)

发现这个网页的那天,心情兴奋地仔细看了十几个主题(我英文不好,看得慢),有些比较有趣的话题,所以即使第二天要上班,还是忍不住看到了四点多才睡觉。其中竟然有人问“How to write spaghetti code in C++??? ”(如何用C++写出意大利面条式的代码),那人说自己用了20多年的Basic而现在被迫升级到C++因此很烦恼,结果有强人贴上了这么段代码:

cpp
 1#define GOTO( n ) { label = n; goto dispatch; }
 2
 3int main()
 4{
 5    int label = 100;
 6    int const taxCoefficient = 5;
 7    dispatch:
 8    switch( label )
 9    {
10        100: { GOTO( 160 ); }
11        110: {} // Nothing to see here, move on, move on!
12        120: { return; }
13        130: { GOTO( 1000*taxCoefficient ); }
14        140: {} // Nothing to see here, move on, move on!
15        150: {} // Nothing to see here, move on, move on!
16        160: { GOTO( 130 );
17        5000: { GOTO 120; }
18    }
19}