3 ms·
Unrelated, but there's a code example on that website: AudioStreamBuilder builder; AudioStream *stream = nullptr; Result result = builder.openStrea
by saagarjha 8y ago
Unrelated, but there's a code example on that website:
AudioStreamBuilder builder;
AudioStream *stream = nullptr;
Result result = builder.openStream(&stream);
Why even bother initializing stream to nullptr if it's going to be overwritten anyways by AudioStreamBuilder::openStream?
- conradev 8y agoI think it's good practice to avoid having uninitialized memory. Just in case, for example, the initialization gets moved inside of an if statement and no one thinks about the else case.
- FigBug 8y agoYou'll probably get a warning about using an uninitialized variable if you don't. Compiler probably can't tell the variable will only be written and not read. It's also just good practice to initialize your variables.
- MauranKilom 8y agoThought the same recently and omitted the initialization. Then Lint yelled at me. I decided it's not a fight worth fighting since it basically costs nothing and is more robust in the face of change.