3 ms·
Well, C doesn't really have strings, just pointers. Calling them "strings" is just an abstraction for us. They don't even have to be null-terminated (even thoug
by hifromwork 2y ago
Well, C doesn't really have strings, just pointers. Calling them "strings" is just an abstraction for us. They don't even have to be null-terminated (even though by convention they often are)!
And this is precisely what I want, in some cases. I use C when I need a low-level byte wrangling code that tightly interfaces with the operating system, or when I can't afford to allocate memory at will (like all effortless string-handling languages do under the hood), or when I don't want any runtime and need my code to behave like a shellcode, basically, or...
I guess C is still used because people find it useful. No need to be a fan of it.
- f1shy 2y ago> I can't afford to allocate memory at will This was my mantra for the last 30 years. But now, even the tiniest thing has 1GB, linux and virtual memory. Except for very edge cases, this excuse is rapidly dying
- cess11 2y agoWhen I browse my local electronics web shops I see a lot of devices that couldn't boot a Linux kernel, some of which I wonder whether I could drive with a small consumer grade solar panel.
- mrkeen 2y agoBut the waste adds up. There are a few projects at work whose integration tests I can't run on my work machine because it doesn't have enough ram (16GB) so I run them on my home PC instead. And that's even when I close IntelliJ, my web browsers, and kill all the background processes I can.
- ben_bai 2y agoby convention: if it's not NUL terminated, it's not a c-string.