Summary:
Because we do this in a few places, and `nullptr` makes it far clearer what the intention is.
Note that with `-Wzero-as-null-pointer-constant` under GCC, doing `std::function<void()> f = {}` initializes `f` with a `0` rather than `nullptr`, triggering the warning, so I've enabled it there as well.
It is not currently possible to actually enable `-Wzero-as-null-pointer-constant`, because GCC 5 reports conversions resulting from a default value as occuring at the call-site rather than at the location where the parameter is defined, and the default allocator in libstdc++ is not clean for this particular warning -_-...
Reviewed By: yfeldblum
Differential Revision:
D6046746
fbshipit-source-id:
6135bb20a503c861838575cf973324d74d75ca69
uint32_t tmp;
size_t rem;
- if (len <= 0 || buf == 0) {
+ if (len <= 0 || buf == nullptr) {
return 0;
}
* (We are avoiding a constructor to ensure gcc allows us to put
* this class in packed structures.)
*/
- void init(T* initialPtr = 0, uint16_t initialExtra = 0) {
+ void init(T* initialPtr = nullptr, uint16_t initialExtra = 0) {
auto intPtr = reinterpret_cast<uintptr_t>(initialPtr);
CHECK(!(intPtr >> 48));
data_.init(intPtr);
{ "ns", 1e-9L },
{ "ps", 1e-12L },
{ "s ", 0 },
- { 0, 0 },
+ { nullptr, 0 },
};
const PrettySuffix kPrettyBytesMetricSuffixes[] = {
{ "MB", 1e6L },
{ "kB", 1e3L },
{ "B ", 0L },
- { 0, 0 },
+ { nullptr, 0 },
};
const PrettySuffix kPrettyBytesBinarySuffixes[] = {
{ "MB", int64_t(1) << 20 },
{ "kB", int64_t(1) << 10 },
{ "B ", 0L },
- { 0, 0 },
+ { nullptr, 0 },
};
const PrettySuffix kPrettyBytesBinaryIECSuffixes[] = {
{ "MiB", int64_t(1) << 20 },
{ "KiB", int64_t(1) << 10 },
{ "B ", 0L },
- { 0, 0 },
+ { nullptr, 0 },
};
const PrettySuffix kPrettyUnitsMetricSuffixes[] = {
{ "M", 1e6L },
{ "k", 1e3L },
{ " ", 0 },
- { 0, 0 },
+ { nullptr, 0 },
};
const PrettySuffix kPrettyUnitsBinarySuffixes[] = {
{ "M", int64_t(1) << 20 },
{ "k", int64_t(1) << 10 },
{ " ", 0 },
- { 0, 0 },
+ { nullptr, 0 },
};
const PrettySuffix kPrettyUnitsBinaryIECSuffixes[] = {
{ "Mi", int64_t(1) << 20 },
{ "Ki", int64_t(1) << 10 },
{ " ", 0 },
- { 0, 0 },
+ { nullptr, 0 },
};
const PrettySuffix kPrettySISuffixes[] = {
{ "z", 1e-21L },
{ "y", 1e-24L },
{ " ", 0 },
- { 0, 0}
+ { nullptr, 0}
};
const PrettySuffix* const kPrettySuffixes[PRETTY_NUM_TYPES] = {
void deactivate() {
#if BOOST_VERSION >= 106100
- auto transfer = boost::context::detail::jump_fcontext(mainContext_, 0);
+ auto transfer =
+ boost::context::detail::jump_fcontext(mainContext_, nullptr);
mainContext_ = transfer.fctx;
auto context = reinterpret_cast<intptr_t>(transfer.data);
#elif BOOST_VERSION >= 105600
boost::context::jump_fcontext(&fiberContext_, mainContext_, 0);
#elif BOOST_VERSION >= 105200
auto context =
- boost::context::jump_fcontext(fiberContext_, &mainContext_, 0);
+ boost::context::jump_fcontext(fiberContext_, &mainContext_, nullptr);
#else
- auto context = jump_fcontext(&fiberContext_, &mainContext_, 0);
+ auto context = jump_fcontext(&fiberContext_, &mainContext_, nullptr);
#endif
DCHECK_EQ(this, reinterpret_cast<FiberImpl*>(context));
}
for (int i=0; i<NUMBUF; ++i)
{
free(buf[i]);
- buf[i] = 0;
+ buf[i] = nullptr;
}
}
#undef NUMBUF
for (int i=0; i<NUMBUF; ++i)
{
free(buf[i]);
- buf[i] = 0;
+ buf[i] = nullptr;
}
}
#undef NUMBUF
static int64_t nowInUsec() {
timeval tv;
- gettimeofday(&tv, 0);
+ gettimeofday(&tv, nullptr);
return int64_t(tv.tv_sec) * 1000 * 1000 + tv.tv_usec;
}