[libc-commits] [PATCH] D84875: [libc] Adds strrchr implementation.
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri Jul 31 10:30:34 PDT 2020
sivachandra accepted this revision.
sivachandra added inline comments.
This revision is now accepted and ready to land.
================
Comment at: libc/src/string/strrchr.cpp:24
+ last_occurrence = str;
+ } while (*str++);
+ return reinterpret_cast<char *>(last_occurrence);
----------------
Nit: To avoid the post-increment operator, may be:
```
for (; ; ++str) {
if (*str == ch)
last_occurance = str;
if (*str == '\0')
break;
}
```
To me personally, mixing post/pre-increment operators with other operators make it hard to read so this comment is also driven by my personal preference.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84875/new/
https://reviews.llvm.org/D84875
More information about the libc-commits
mailing list