| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
In convert_from_v8.cc, the unwrapping of values uses two separate lines of code for variable declaration and variable assignment. When a pointer (or double pointer) is present, the assignment to the newly declared variable creates a compiler warning. To prevent the compilation logs from filling up unnecessarily, pointer variables should initially be assigned a `NULL` value upon its declaration so that the compiler will not emit a warning on the subseqent variable assignment line.
|
The compiler warnings have been bugging me for awhile. Thanks for fixing some of them! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
When compiling the C++ bridge code, you will see several warnings about the use of uninitialized variables.
Linux / OSX
../src/config.cc:376:2: warning: variable 'from_tx' is uninitialized when used here [-Wuninitialized] *from_tx = Nan::ObjectWrap::Unwrap<GitTransaction>(info[0]->ToObject())->GetValue(); ^~~~~~~ ../src/config.cc:375:29: note: initialize the variable 'from_tx' to silence this warning git_transaction ** from_tx; ^ = nullptrWindows
The warnings above can easily be fixed by initializing these pointer variables to NULL. We should strive to have as few warnings as possible in the code (if not zero) to make the compilation logs more readable by improving the signal to noise ratio wherever possible.