当你使用uint_least16_t [英] when would you use uint_least16_t

查看:561
本文介绍了当你使用uint_least16_t的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看stdint.h并给予它有uint16_t和uint_fast16_t,什么是uint_least16_t使用你可能想什么不能与其他两个中的一个来完成同样好?

I'm looking at stdint.h and given that it has uint16_t and uint_fast16_t, what is the use for uint_least16_t what might you want that couldn't be done equally well with one of the other two?

推荐答案

说你与编译器的工作:


  • unsigned char型为8位

  • 无符号短 32位

  • unsigned int类型 64位

  • unsigned char is 8 bits
  • unsigned short is 32 bits
  • unsigned int is 64 bits

和unsigned int是最快。在该平台:

And unsigned int is the 'fastest'. On that platform:


  • uint16_t 会的的可用

  • uint_least16_t 将是一个32位值

  • uint_fast16_t 将是一个64位值

  • uint16_t would not be available
  • uint_least16_t would be a 32 bit value
  • uint_fast16_t would be a 64 bit value

一个有点神秘,但是这就是它是。

A bit arcane, but that's what it's for.

如何有用他们是另一回事 - 我看到的确切大小变种所有的时间。这是人们想要什么。在最和快的版本我已经看到了使用pretty从来没有接近(这是可能的,它只是在例如code - 我真的不知道)。

How useful they are is another story - I see the exact size variants all the time. That's what people want. The 'least' and 'fast' versions I've seen used pretty close to never (it's possible that it was only in example code - I'm really not sure).

这篇关于当你使用uint_least16_t的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆