r/cprogramming • • Aug 17 '26

C Strings: A 50-Year Mistake

https://longtran2904.substack.com/p/c-strings-a-50-year-mistake?r=8qz2zb&utm_campaign=post&utm_medium=web
212 Upvotes

172 comments sorted by

View all comments

Show parent comment

51

u/Voyac Aug 17 '26

Its main purpose is to be portable to as many architectures as possible. Maybe this seem irrelevant in a world dominated by ARMs and x86 but there are different platforms.

-40

u/Potential_Soup_8054 Aug 17 '26

No, thats java

28

u/g0atdude Aug 17 '26

lol what?

You can compile C programs to a million more devices than what Java runs on

4

u/Potential_Soup_8054 Aug 17 '26

It was a joke. Javas whole slogan is write once run everywhere, but thats really bullshit.

3

u/Devatator_ Aug 17 '26

Tbh nothing is stopping people from compiling or porting a JVM to more platforms. I assume it's just extremely complex and noth worth it for most people

1

u/hughperman Aug 21 '26

Processor or memory requirements are probably? stopping it on many microcontrollers.

1

u/Devatator_ Aug 21 '26

You could do something similar to nanoFramework and make a minimal runtime or even compile Java to a lower level

1

u/Potential_Soup_8054 Aug 21 '26

Uh huh, and what is every JVM implementation written in? Motherfucking C

2

u/EdwardTheGood Aug 19 '26

I once heard it rephrased as “write once, test everywhere.”

10

u/mustbeset Aug 17 '26

50% of my time I get paid to write C code on a "none Arm", "none x86" architectur and I don't have enough space for a java runtime.

5

u/Voyac Aug 17 '26

Yeah sometimes even 8bit MCUs with a drop of memory. You wont fit a string.h sometimes and lol what about java runtime :)

7

u/mustbeset Aug 17 '26

My current pain in the ass is a bootloader update for existing devices in field. fighting for 300 bytes.