gpt4 book ai didi

c++ - 如何在 visual studio 2019 中修复 "[member variable that is a vulkan struct] is uninitialized. Always initialize a member variable"?

转载 作者:行者123 更新时间:2023-11-28 04:15:04 24 4
gpt4 key购买 nike

<分区>

我从 Visual Studio 2017 切换到 2019,我遇到了以前没有收到的警告。如果我有一个 Vulkan 类型的成员变量(即 VkCommandPool、VkBuffer 等)未在默认构造函数中初始化,我会收到问题标题中列出的警告。

我试过像

这样的陈述
this->buffer = {};

this->buffer = 0;

但两者似乎都没有做任何事情。

示例类:

class Example {
private:
VkBuffer buffer;
public:
// warning comes from here
Example() {
// NOTE: even with initialization in the constructor, I STILL get a warning
this->buffer = 0;
this->buffer = {};
}

// calls init with parameters
Example(/* parameters */) {
// implementation not relevant to the question
}
void init(/* parameters */) {
// implementation not relevant to the question
}
};

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