Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: BGB Newsgroups: comp.lang.java.programmer Subject: Re: =?UTF-8?B?QW5kcm9pZOKAlFdoeSBEYWx2aWs/?= Date: Wed, 01 Jun 2011 03:21:44 -0700 Organization: albasani.net Lines: 50 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.albasani.net 2x8Na9xQXRaLA/E+uCOaIiwSSmymGt4K9rj2elVZQO/lAFR5R4fR7DPR/Tftv0e2wfYAMdy716fUTHtrS6qCaA== NNTP-Posting-Date: Wed, 1 Jun 2011 10:24:48 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="WbhH31m1oPj0tYWcMBYTAWmzVqDZA7m6gmAEAeviNXYj/EGzNnI3pA1lWMd3ZDc+SoBBDBOtL7Y1sQ4RBze/lGEht5atCiEavyHTU+QcOosmYcwKWEzI457sBQp3A+KD"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:7tbXctQc6oBU/OJP5T8j8Crv+tc= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4849 On 5/31/2011 9:58 PM, Joshua Cranmer wrote: > On 05/31/2011 11:05 PM, Lawrence D'Oliveiro wrote: >> Using MSVC brings its own share of problems. I remember on the Python >> group, >> if you wanted to build a C/C++ extension for Python, you had to >> compile it >> with the exact same version of MSVC as was used for that version of >> Python, >> otherwise it wouldn’t work. > > Funny. I thought C/C++ was supposed to be portable. With Java, it > doesn't matter which compiler I use to link the binary, they all the do > same thing. Even if I don't program my code in Java. ;-) > > Java has extreme ABI portability--any compiler, any OS, any arch. C is > somewhat portable (between compilers on the same OS and arch), and C++ > isn't very portable between compilers, particularly MSVC/gcc 3.x/gcc 4.x. > yeah... sadly, the C ABI is a little bit prone to variations, I suspect often because compiler/ABI implementers are prone to try to micro-optimize things at the ABI level, leading to fussy special cases, and cases where the compilers often vary. for example, in the usual x86 C ABI: values are generally passed on the stack; structs are generally done by passing the return-value address to the called function; ... some compilers, in their wisdom, in certain cases, try to pass arguments in registers, or try to return the struct in registers, ... then compiler A and B break because A expected the return value to be via a memory copy and B expected it via registers, ... and, certain ABIs, such as the AMD64 ABI, are just plain complicated... (I personally like the design of the Win64 x64 ABI better, as it is much simpler...). then with C++, there is a somewhat different problem: nearly every compiler has its own ABI (or subtle variations on an existing ABI), and in the GCC 3/4 case, because they changed the C++ ABI between compiler versions. sadly though sometimes, the linker just blowing up in ones face is actually often the better case.