Re: good c compiler
- From: Flash Gordon <smap@xxxxxxxxxxxxxxxxx>
- Date: Thu, 25 Sep 2008 22:13:27 +0100
jacob navia wrote, On 25/09/08 21:10:
Flash Gordon wrote:Keith Thompson wrote, On 25/09/08 16:34:Flash Gordon <smap@xxxxxxxxxxxxxxxxx> writes:
[...]
Jacob has, IMHO, made the correct decision in following the platform[...]
ABI for the platforms he is targeting. He just needs to stamp in big
letters across his documentation that on Windows he does not follow it
for "long double" (for perfectly valid reasons) and so people need to
stick to float/double in interfaces which might be accessed from other
implementations.
Are you sure about that?
My understanding from this thread is that lcc implements long double
with the same size as double, and lcc-win implements long double with
a larger size than double. I haven't seen anything in this thread to
indicate that the latter violates the Windows ABI. But then, I'm not
familiar with the Windows ABI.
If you get a library compiled with lcc-win32 that uses it's long double how will you pass it a correct value when calling the library from MSVCC? Same for return values. As to passing pointers to long doubles...
Same problem in reverse if the library is compiled with MSVC and the header refers to long double, although way round you can fix it by changing the header.
I've no idea if the ABI defines the format for long double, but using a different format not supported by a major vendor can lead to problems.
Note that I'm NOT saying Jabob's decision is bad or unreasonable, just something the users of his compiler need to be aware of IF their code will be linked with code compiled with other compilers.
No Microsoft header uses long double.
I said a library built *with* MSVC. Do you know every single library built using MSVC?
The ABI will not mention long
double, so there isn't any problem.
Please actually read what I wrote. There IS potential for problems.
If a long double arguments get's
passed to an MSVC library function the prototype is double and NOT long
double since MS never uses long double in their headers.
I was not talking about libraries written BY MS, I was talking about libraries build USING MSVC. Have you looked at the headers for every single library that is distributed as a binary and built with MSVC?
So, there is no
problem, the long double will be passed as a double.
Not if the header you have never seen specifies long double.
Also you have completely failed to address the converse situation where someone builds a library using lcc-win32 using long double in the interface and I then try (without access to the source of the library since this could be one of your commercial customers) to link to it from code compiled with MSVC.
As I say, your decision to use higher precision and range for long double is perfectly defensible but the restrictions it imposed on linking with code built with different compilers should be clearly stated.
--
Flash Gordon
If spamming me sent it to smap@xxxxxxxxxxxxxxxxx
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
.
- Follow-Ups:
- Re: good c compiler
- From: jacob navia
- Re: good c compiler
- References:
- good c compiler
- From: bernard
- Re: good c compiler
- From: Richard Heathfield
- Re: good c compiler
- From: s0suk3
- Re: good c compiler
- From: jacob navia
- Re: good c compiler
- From: James Kuyper
- Re: good c compiler
- From: jacob navia
- Re: good c compiler
- From: James Kuyper
- Re: good c compiler
- From: jacob navia
- Re: good c compiler
- From: Bart van Ingen Schenau
- Re: good c compiler
- From: jacob navia
- Re: good c compiler
- From: CBFalconer
- Re: good c compiler
- From: Ian Collins
- Re: good c compiler
- From: CBFalconer
- Re: good c compiler
- From: Flash Gordon
- Re: good c compiler
- From: Keith Thompson
- Re: good c compiler
- From: Flash Gordon
- Re: good c compiler
- From: jacob navia
- good c compiler
- Prev by Date: Re: Memory used by the program
- Next by Date: Re: A very **very** basic question
- Previous by thread: Re: good c compiler
- Next by thread: Re: good c compiler
- Index(es):
Relevant Pages
|