Hi all,

I implemented a C program using my mac book.
Now, my client wants to migrate to windows OS (MinGW).

Program does many calculation using long double: on mac it works fine, otherwise on winz doesn't.

I read on internet the problem is that long double type is supposed to be a double type in WinZ, because it is no supported.

Making sizeof of double and long double, I obtain:
MAC
DOUBLE=8, LONG DOUBLE=16
WINZ
DOUBLE=8, LONG DOUBLE=12

Is there a solution or a workaround?
How can I "force" the use of long double or its simulation?

Sorry for my English.
Thanks in advance

The size of long double is compiler-dependent, not operating system dependent. What compiler did you use on MS-Windows? I know Microsoft VC++ does not support long double -- the name is recognized the but the is the same as double. MinGW on MS-Windows (Code::Blocks) produces the same results that you posted. Why 12 I can only guess is sizeof(long) + sizeof(double).

So, is there any way to bring my program in windows and make sure that is working properly, as it happens on the mac?

Here is a blog that may help you. You might use a different compiler, such as Intel. The blog also discusses some other options.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.