diff options
author | Abseil Team <absl-team@google.com> | 2023-08-31 11:09:29 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-08-31 11:10:29 -0700 |
commit | a4b11563f9c3706339209526cbd3b819fca773e8 (patch) | |
tree | 9924a8af59a9cab060c13c6f476843697d66d0cd /absl/strings | |
parent | 79c40c6432daec76883d693924f4e5597517f905 (diff) |
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
Diffstat (limited to 'absl/strings')
-rw-r--r-- | absl/strings/string_view.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/absl/strings/string_view.cc b/absl/strings/string_view.cc index f20ff530..1ee468c8 100644 --- a/absl/strings/string_view.cc +++ b/absl/strings/string_view.cc @@ -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; |