What is int8_t if a machine has > 8 bits per byte?

后端 未结 2 1070
借酒劲吻你
借酒劲吻你 2021-02-19 03:51

I was reading the C++ FAQ and it says

The C++ language guarantees a byte must always have at least 8 bits

So what does that mean for

2条回答
  •  时光说笑
    2021-02-19 04:34

    To add to what Cat Plus Plus has already said (that the type is optional), you can test whether it is present by using something like:

    #ifdef INT8_MAX
    //  type int8_t exists.
    #endif
    

    or more likely:

    #ifndef INT8_MAX
    #error Machines with bytes that don't have 8 bits aren't supported
    #endif
    

提交回复
热议问题