Hi,
This is a basic question that's why i am confused.
When I do printf("%d",sizeof(long double))
in Linux(i am using a vmware)
Ans:12 bytes
in msvc 2008
Ans:8 bytes

My underlying arch for both implementation is intel IA32.
What is the reason if the arch is same.If the fundamental data types sizes depend upon the arch ,then the output for both are supposed to be same.
Please guide me.

Cheers!!

Probably because MS chose to make long double and double the same thing.

A long double is IIRC only 80 bits (10 bytes), but to preserve alignment, the compiler rounds out the size to a multiple of 4.

The underlying architecture isn't the whole story.

Running crusty old 16-bit turboc on your nice new machine doesn't magically make int into a 32-bit number.

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.