Commit cf6ef289 authored by Ondrej Lehecka's avatar Ondrej Lehecka Committed by Facebook Github Bot

Cursor::read<T>() initializes return value

Summary:
If the compiler doesn't see thru the call to tryRead which always initializes the val variable, it will emit the following error.
I was getting error when compiling my android project:
error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This should not have a negative perf impact as smart compilers which inline call to tryRead can elliminate the initialization.

Reviewed By: djwatson

Differential Revision: D4790864

fbshipit-source-id: f353cfe54ca4d056b6ddfc075d00580c9f2d391e
parent 7f2dce70
......@@ -227,7 +227,7 @@ class CursorBase {
template <class T>
T read() {
T val;
T val{};
if (!tryRead(val)) {
std::__throw_out_of_range("underflow");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment