- 论坛徽章:
- 0
|
Is the binary code compiled by GCC compatible with code compiled with Sun Studio compilers?
a) Yes
b) No
c) Yes and No
d) 42
The correct answer is c.
'Yes,' C code compiled by the gcc Compiler is binary-compatible with C code compiled by the Sun C compiler. You should be able to mix gcc and Sun C binaries in the same program without a problem.
'No,' C++ code compiled by g++ is not binary compatible with C++ code compiled by Sun C++. However, if the g++ code is completely self-contained, that should be OK. "Completely self-contained" means all of the following:
1. The g++ code presents a pure C interface; only functions, types, and objects acceptable to a standard C compiler are in the interface.
2. The g++ code does not throw an exception that could pass through non-g++ code. It is best if the g++ code does not use any exceptions.
3. The g++ code does not use the predefined iostreams cin, cout, cerr, clog (or the wide-stream equivalents).
While '42' is, as we all know, the answer to everything, unfortunately, it is not the answer to this question.
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/27174/showart_467062.html |
|