News for hackers. Stuff that matters.
Re:Why it’s necessary to shoot yourself in the foot by jstimpfle on Saturday July 15, 2023 @02:23AM (#36734125)
The talking point is a string type that can be used with some convenience. Let's say join multiple of them together at runtime with '+'. Or whatever, maybe just a function call. I was explaining why it doesn't just work like that.

The str type you mention is a nice feature, and in the future when I will have switched to Rust or whatever, I might use it to write my programs in 5 lines less.

While in C I have to use C's "slice" type: char x[] = "Hello". I know it's not quite as good since if I was to pass this around, I would have to make a pointer + length representation for this. If I needed it, it can be automatized from string literals: #define STRING(lit) String(lit "", sizeof lit - 1).

For the few situtations where I'm dealing with string manipulation in systems programming, it's just not a real problem.

There are no comments on this comment yet.