- 论坛徽章:
- 0
|
是的,这就叫 implementation-defined behavior。
看见这种面试题,完全可以直接彪悍地写上一句:依赖于实现。
真用这种面试题的公司,不去也罢。
J:\>cl testincr.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
testincr.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:testincr.exe
testincr.obj
J:\>testincr
9
12
J:\>
这是 GCC 3 (i386)
$ gcc -o testincr testincr.c
$ ./testincr
9
12
再给你看一下 MSC 6.0 的输出: |
|