Cursor::read<T>() initializes return value
authorOndrej Lehecka <lehecka@fb.com>
Wed, 29 Mar 2017 01:58:12 +0000 (18:58 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 29 Mar 2017 02:12:52 +0000 (19:12 -0700)
commitcf6ef289c712ccd021fd9d66dc4cc509fc13c725
treefa6d3be3e9c6ba13bf3a7f8625e8269f1f148fb6
parent7f2dce7009e8575814d3e51c3fd3f124aa8228dd
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
folly/io/Cursor.h