On Friday, July 3, 2020, Jody Bruchon <j...@jodybruchon.com> wrote: > > > On July 2, 2020 11:29:06 AM EDT, Kang-Che Sung <explore...@gmail.com> wrote: >>On Thursday, July 2, 2020, Jody Bruchon <j...@jodybruchon.com> wrote: >>> /* Find out if the last character of a string matches the one given >>*/ >>> -char* FAST_FUNC last_char_is(const char *s, int c) >>> +char* FAST_FUNC last_char_is(char *s, char c) >> >>Why are you removing the const qualifier, and how would that reduce the >>code size? > > Why does it need the const in the first place? The code I wrote does reduce the code size.
Any pointer parameter whose content is meant to be read-only is good to be declared const. It's a compiler safety check that you won't accidentally modify the content there. The const qualifier by itself doesn't add code.
_______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox