gpt4 book ai didi

C++ Declspec 对齐

转载 作者:搜寻专家 更新时间:2023-10-31 01:21:23 25 4
gpt4 key购买 nike

您好,我是 Visual C++ 的新手,有人可以解释一下结构中声明的 ConfParams() 的作用

__declspec(align(BYTE)) struct ConfParams
{
BOOL m_timeout;
DOUBLE m_caution;
ConfParams();
}

最佳答案

Could Someone please explain what ConfParams() declared in a structure does

这是一个构造函数声明。

在 C++ 中,除了默认可访问性级别之外,structclass 是等效的。 struct 默认有 public 成员,class 默认有 private 成员。


我不清楚为什么你的主题引用了 __declspec 但如果那是你想知道的 see here .

成员函数没有对齐,只有数据受到影响。

关于C++ Declspec 对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3826943/

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