Re:C Strings and my slow descent to madness
by FpUser on Thursday April 06, 2023 @09:39AM
(#35468167)
C strings are bad for sure. Consider those raw assembly. Instead of using it directly get some decent string library ASAP and use it exclusively.
[ Parent
| on HN ]
Re:C Strings and my slow descent to madness
by jstimpfle on Thursday April 06, 2023 @10:05AM
(#35468461)
They are just arrays, like everything else in the language. If you don't want to manage plain arrays, better look for a different language.
Re:C Strings and my slow descent to madness
by FpUser on Thursday April 06, 2023 @10:07AM
(#35468494)
You are free to make good use of strings as arrays. I've written tons of code including firmware for MCU so I think I'll keep to my own practices.
Re:C Strings and my slow descent to madness
by throwawaymaths on Thursday April 06, 2023 @01:12PM
(#35471381)
they are not "just" arrays, they are arrays with a null-terminated expectation. Most of the time. The lack of consistency and difficulty communicating the expectations is what is hair-pulling in C, and that's on top of the difficulty of communicating the difference between an array and a pointer in C.