gpt4 book ai didi

c - iOS 中标志结构的用途是什么?

转载 作者:可可西里 更新时间:2023-11-01 04:40:28 25 4
gpt4 key购买 nike

struct
{
unsigned resizesCellWidths:1;
unsigned numColumns:6;
unsigned separatorStyle:3;
unsigned allowsSelection:1;
unsigned backgroundViewExtendsUp:1;
unsigned backgroundViewExtendsDown:1;
unsigned usesPagedHorizontalScrolling:1;
unsigned updating:1;
unsigned ignoreTouchSelect:1;
unsigned needsReload:1;
unsigned allCellsNeedLayout:1;
unsigned isRotating:1;
unsigned clipsContentWidthToBounds:1;
unsigned isAnimatingUpdates:1;
unsigned requiresSelection:1;
unsigned contentSizeFillsBounds:1;
unsigned delegateWillDisplayCell:1;
unsigned delegateWillSelectItem:1;
unsigned delegateWillSelectItemMultiTouch:1;
unsigned delegateWillDeselectItem:1;
unsigned delegateDidSelectItem:1;
unsigned delegateDidSelectItemMultiTouch:1;
unsigned delegateDidDeselectItem:1;
unsigned delegateGestureRecognizerActivated:1;
unsigned delegateAdjustGridCellFrame:1;
unsigned delegateDidEndUpdateAnimation:1;
unsigned dataSourceGridCellSize:1;
unsigned int isEditing:1;
unsigned __RESERVED__:1;
} _flags;
  1. 这个结构的目的是什么?
  2. 每行末尾的 :1 符号表示什么?
  3. 当没有显式类型时,unsigned 修饰符的含义是什么?

谢谢

最佳答案

那些是 bitfields .由于其中大部分是标志,它们只有 2 个可能的值,因此无需为每个字段分配超过 1 位。 (该结构中有几个异常(exception))

unsigned 可以作为一种类型独立存在。它只是一个 unsigned int

关于c - iOS 中标志结构的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7911015/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com