面试问题,盼答案

1) Why is this program not portable:

#include
#include

/* This function returns a value in which bit 'n' is set. Bits are
counted from right to left. The rightmost bit (the least significant
bit) is bit #0. */
long
set_bit(unsigned n)
{
assert(n
return 1 }




2) A flex input file contains this regular expression that is supposed
to match a C comment. Is it correct? If not, why not.

"/*""/"*([^*/]|[^*]"/"|"*"[^/])*"*"*"*/"





3) In Perl, what's the difference between "my" and "local"? When should
"local" be used?

所有跟帖: 

Q #3 - the scope of variables -胡说之- 给 胡说之 发送悄悄话 胡说之 的博客首页 (252 bytes) () 08/25/2010 postreply 14:48:27

Q1: can run into infinite loop with a dumb compiler -catcher- 给 catcher 发送悄悄话 (0 bytes) () 08/25/2010 postreply 17:30:04

好的compiler恰恰应该给出编译错误,不是吗? -吃糖?- 给 吃糖? 发送悄悄话 (49 bytes) () 08/25/2010 postreply 21:35:34

帖子里不能显示back slash, 你的第二题显示不完整 -胡说之- 给 胡说之 发送悄悄话 胡说之 的博客首页 (0 bytes) () 08/25/2010 postreply 19:18:57

尽管如此,可以猜测一下 -胡说之- 给 胡说之 发送悄悄话 胡说之 的博客首页 (115 bytes) () 08/25/2010 postreply 19:22:57

回复:面试问题,盼答案 -老憨头- 给 老憨头 发送悄悄话 (95 bytes) () 08/25/2010 postreply 20:48:56

请您先登陆,再发跟帖!