Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize class/struct variables with default values in modules/ #43952

Merged
merged 1 commit into from
Feb 8, 2021

Conversation

qarmin
Copy link
Contributor

@qarmin qarmin commented Nov 29, 2020

Part of #43636

In future it may also allow to run Memory sanitizer without too big error spam

modules/enet/networked_multiplayer_enet.cpp Outdated Show resolved Hide resolved
modules/webrtc/webrtc_data_channel_js.h Outdated Show resolved Hide resolved
modules/webrtc/webrtc_data_channel_js.cpp Show resolved Hide resolved
@@ -47,7 +47,7 @@ class TextureBasisU : public Texture {
RID texture;
Size2 tex_size;

uint32_t flags;
uint32_t flags = FLAGS_DEFAULT;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uint32_t flags = FLAGS_DEFAULT;
uint32_t flags = FLAGS_DEFAULT;

@@ -43,7 +43,6 @@ btRayShape::btRayShape(btScalar length) :
m_shapeAxis(0, 0, 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be moved to the header too.

Comment on lines 417 to 418

editor = nullptr;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this go in the header? And button and library_editor can also be initialized to nullptr to be safe, even if they then get assigned values here.

k2 = 0.215;
last_ticks = 0;
};
MobileVRInterface::MobileVRInterface(){};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MobileVRInterface::MobileVRInterface(){};
MobileVRInterface::MobileVRInterface() {}

MobileVRInterface::MobileVRInterface() {
initialized = false;

// Just set some defaults for these. At some point we need to look at adding a lookup table for common device + headset combos and/or support reading cardboard QR codes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to port this comment to the header too.

@@ -41,11 +41,11 @@ class AudioStreamOGGVorbis;
class AudioStreamPlaybackOGGVorbis : public AudioStreamPlaybackResampled {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed AudioStreamOGGVorbis() which has plenty of stuff to move to the header.

Ref<StreamPeer> conn;
Ref<StreamPeerTCP> tcp;
int id;
int id = 1;
wslay_event_context_ptr ctx;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wslay_event_context_ptr ctx;
wslay_event_context_ptr ctx = nullptr;

@akien-mga
Copy link
Member

Left a few comments, otherwise should be good to merge, I looked through the whole diff.

@akien-mga akien-mga merged commit 332a335 into godotengine:master Feb 8, 2021
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants