Re:Why is strlen so complex in C?
by ridiculous_fish on Monday August 26, 2019 @08:49PM
(#20805238)
The trailing semicolon on that for loop is quite load-bearing. I would have some code review feedback.
Re:Why is strlen so complex in C?
by anticensor on Sunday September 08, 2019 @03:34PM
(#20912841)
It can be replaced by continue; in this specific case.
Looks very simple to me. I love it.
Nope, for sure not.
A good implementation would stick to the standard (size_t nor word_t), and would inc the pointer, not the counter. Formatting would be better (the final ; ouch).
This is junior stuff.
Maybe verification tools choke on pointer incrementing?
Having worked on a variety of code bases and coding styles, I think if there are coding rules and they are consistent across all the source files, it becomes easy to read even with wierdnesses. I hated perl with @_ and $_, but after working with it enough they became known quantities.
And you can probably read all the lines of code in your lifetime, since the whole microkernel is ~30k lines of code.
https://github.com/seL4/seL4 (from file src/string.c)