56
submitted 1 year ago by petsoi@discuss.tchncs.de to c/linux@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] 257m@sh.itjust.works 1 points 1 year ago* (last edited 1 year ago)

Floats are implemented on most hardware by the instruction set so the language has no control over those unless your programming on a microcontroller like an atmega328p in which case you have to implement it yourself. As for why no in built support for strings is available in C is mostly due to C programmer hating change. Most hardcore C programmers are still using C89 (and the majority C99) and you can't change old standards. C dosen't need more features it needs less. I am a big fan of removing for loops like Zig to make the langauge simpler. That way it can maintain its minimalism. The more minimalistic the easier to write compilers.

[-] FooBarrington@lemmy.world 1 points 1 year ago* (last edited 1 year ago)

Modern hardware also has specific instructions to speed up C string operations for the common ways they are implemented. We rely on compiler optimisation for those as well. Why not do the same for floats?

[-] 257m@sh.itjust.works 1 points 1 year ago

Because the language already supports it. Its not a question of what modern hardware can do just backwards compatibility and not changing the language too much. There would be no point in adding these features because if you want them you can just use Modern C++. There is no need for two identical languages occupying the same niche.

[-] FooBarrington@lemmy.world 1 points 1 year ago

I'm not arguing for C implementing classes and all other C++ features, only for a basic data type used in most programs. Backwards compatibility is also a pretty poor argument considering new versions of C are released every couple of years with new features, already breaking backwards compatibility. Why is this specific change too much?

this post was submitted on 03 Oct 2023
56 points (93.8% liked)

Linux

47766 readers
1494 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS