People who still write C, honest question: Why? C is full of quirks. From cryptic "undefined behaviors" to a type system that isn't really a type system (more like "size hints for the compiler"), the language doesn't feel easy to use/debug. Add to this CPP macros, a universally recognized bad idea, a clunky import system, and lack of a single reference implementation of the compiler/libC, and you have a language that…
Because everything speaks C. If you write a library in C, it can be easily exposed to a variety of high-level languages and platforms. You might argue this is more a property of the C ABI than of C itself, but unless the project is large enough that it's worth doing it in C++ or Rust instead, it's still a very reasonable choice. Also not everything is web. Sure, if you're writing API endpoints in C you're just shooti…
The Development of the C Language (1993)
41–50 of 536 posts
Re: The Development of the C Language (1993)
#42I wonder how much the pile of undefined behavior contributed to C's success. I can imagine that vendors picked C over alternatives due to C giving them more freedom with their implementation.
The answer is different for different kinds of undefined behavior, but spatial memory safety violations are basically always possible in a language you can write an OS in, since you need to convert from hardware buffers to higher level types. temporal memory safety wasn't possible to enforce at the time on a low level language, it's taken decades for it to be implemented in a mainstream non-garbage-collected language. Integer overerflow is still not caught by default even in rust for efficiency reasons (it would take all the processor vendors to implement an efficient way of catching it)
Re: The Development of the C Language (1993)
#43People who still write C, honest question: Why? C is full of quirks. From cryptic "undefined behaviors" to a type system that isn't really a type system (more like "size hints for the compiler"), the language doesn't feel easy to use/debug. Add to this CPP macros, a universally recognized bad idea, a clunky import system, and lack of a single reference implementation of the compiler/libC, and you have a language that…
> The C representation of memory (and all the pointer arithmetic) is not a real representation of your hardware, and this too is an abstraction. By and large memory is a contiguous array and the C representation closely matches what is actually happening, so I am curious about which platforms you have worked on.
Re: The Development of the C Language (1993)
#44Earlier quoted context omitted.
>I really hate how for microcontrollers the only two choices are either C++ or Micropython There's TinyGo as well. https://tinygo.org/ I'd say that's the middle ground for me.
It is nice, but nowhere near as complete feature-wise than C/C++. The fact that it exists does not mean you can use it to achieve the same thing.
Seems to do exactly what 99% of people need.
Re: The Development of the C Language (1993)
#45Earlier quoted context omitted.
Because everything speaks C. If you write a library in C, it can be easily exposed to a variety of high-level languages and platforms. You might argue this is more a property of the C ABI than of C itself, but unless the project is large enough that it's worth doing it in C++ or Rust instead, it's still a very reasonable choice. Also not everything is web. Sure, if you're writing API endpoints in C you're just shooti…
So we're gonna be stuck writing a precambrian prototype language till the end of time because there's so much legacy code already written in it? Never seemed to stop people moving from Pascal, or Perl or literally all other languages that are now obsolete. I really hate how for microcontrollers the only two choices are either C++ or Micropython, I mean how about some fucking middle ground instead of two polar opposit…
Re: The Development of the C Language (1993)
#46This might miss a (1993) tag. Interestingly, some might print the same title about JavaScript.
Re: The Development of the C Language (1993)
#47Earlier quoted context omitted.
bits are not addressable in C and are thus not directly accessible.
They are also not normally directly addressable by the CPU, you'll have to do some combining and splitting with separate instructions. Some CPUs are better at this than others.
Re: The Development of the C Language (1993)
#48Earlier quoted context omitted.
It is nice, but nowhere near as complete feature-wise than C/C++. The fact that it exists does not mean you can use it to achieve the same thing.
What do you mean no where near as complete feature wise? Go or specifically the TinyGo implementation? Seems to do exactly what 99% of people need.
Re: The Development of the C Language (1993)
#49People who still write C, honest question: Why? C is full of quirks. From cryptic "undefined behaviors" to a type system that isn't really a type system (more like "size hints for the compiler"), the language doesn't feel easy to use/debug. Add to this CPP macros, a universally recognized bad idea, a clunky import system, and lack of a single reference implementation of the compiler/libC, and you have a language that…
You do what your operating system vendor does.
Not few operating systems have a C interface. The implementation of binaries (see also application binary interfaces) depends on the operating system.
Shared libraries (e.g., DLL) are binaries, too.
C compiler developers have the ability to generate consistent[1] binary outputs.
In simpler terms, vendors of these compilers can reach a consensus on how to convert C code into binary files, known as Application Binary Interfaces (ABI).
It is not uncommon[2] to have a foreign function interface in C.
1. http://yosefk.com/c++fqa/defective.html
2. https://learn.microsoft.com/en-us/cpp/dotnet/calling-native-...
Re: The Development of the C Language (1993)
#50Earlier quoted context omitted.
It is nice, but nowhere near as complete feature-wise than C/C++. The fact that it exists does not mean you can use it to achieve the same thing.
What do you mean no where near as complete feature wise? Go or specifically the TinyGo implementation? Seems to do exactly what 99% of people need.