Search code examples
c++gcclong-double

GCC: Restrict long double width


Is there a way/switch to restrict the size of long doubles to 64 bits when compiling using GCC?


Solution

  • Possibly via -mlong-double-64 command line switch, but the question is: why do you want to do that?

    The x86 ABI and x86-64 System V ABI mandate a long double of 96/80 bits respectively¹, i.e. you need to recompile not only your application, but anything it uses which exposes a long double in the API.

    ¹ And according to the same doc, GCC on x86-64 uses 128-bit long doubles.