Commit a4b11563 by Abseil Team Committed by Copybara-Service

Revise a comment regarding casting `memchr()`'s return type. The original…

Revise a comment regarding casting `memchr()`'s return type. The original comment seemed to suggest that the return type varies depending on the compiler and hence the `static_cast` is needed.

PiperOrigin-RevId: 561706189
Change-Id: Ie244d235d082536edfca263d4165e16171cbc6c7
parent 79c40c64
......@@ -37,8 +37,8 @@ const char* memmatch(const char* phaystack, size_t haylen, const char* pneedle,
const char* match;
const char* hayend = phaystack + haylen - neelen + 1;
// A static cast is used here to work around the fact that memchr returns
// a void* on Posix-compliant systems and const void* on Windows.
// A static cast is used here as memchr returns a const void *, and pointer
// arithmetic is not allowed on pointers to void.
while (
(match = static_cast<const char*>(memchr(
phaystack, pneedle[0], static_cast<size_t>(hayend - phaystack))))) {
......@@ -229,7 +229,6 @@ string_view::size_type string_view::find_last_not_of(
return npos;
}
#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr string_view::size_type string_view::npos;
constexpr string_view::size_type string_view::kMaxSize;
......
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