What's the point of float_t and when should it be used?

后端 未结 3 976
醉梦人生
醉梦人生 2021-02-05 07:45

I\'m working with a client who is using an old version of GCC (3.2.3 to be precise) but wants to upgrade and one reason that\'s been given as stumbling block to upgrading to a n

3条回答
  •  长情又很酷
    2021-02-05 08:06

    The reason for float_t is that for some processors and compilers using a larger type e.g. long double for float could be more efficient and so the float_t allows the compiler to use the larger type instead of float.

    thus in the OPs case using float_t the change in size is what the standard allows for. If the original code wanted to use the smaller float sizes it should be using float.

    There is some rationale in open-std doc

    for example the type definitions float_t and double_t (defined in ), are intended to allow effective use of architectures with more efficient, wider formats. Annexes

提交回复
热议问题