4 ms·
> I will never understand why C keeps Well, I, for one, do like the idea of C (in contrast to D or C++) still being sort of the lowest-level high-level program
by Koshkin 2y ago
> I will never understand why C keeps
Well, I, for one, do like the idea of C (in contrast to D or C++) still being sort of the lowest-level high-level programming language - one that's just a notch above the assembler.
- gpderetta 2y agoWhat's lower level on C compared to C++ or D?
- WalterBright 2y agoNothing. You can get just as down and dirty in D as you can in C. You just don't have to suffer under the preprocessor as it blasts your kingdom. And you've got a fully functional inline assembler, and modules.
- Koshkin 2y agoI have heard about an object-oriented assembler (never seen one, though).
- gizmo686 2y agoThere is nothing particuarly low level about null terminated strings. It is just a convention that a bunch of standard library functions follow. Then there is a dozen variants of each of those standard library functions, most of which end up making you pass in some form of a length parameter anyway, because the convention is so terrible. At this point, I think we might be in a better world if C simply did not offer any string API in the first place. If
- yuliyp 2y agoDid your comment get cut off because you embedded a null inside it?
- fuzztester 2y agoye
- Koshkin 2y ago> It is just a convention that a bunch of standard library That’s not true, this representation of strings (in the form of a literal) is built into the language itself.
- II2II 2y agoExpressing strings as null terminated or in a data structure that includes the size and data has no relationship to it being a higher or lower level language. They still need to determine where a string starts and ends in memory. The means of doing so is different, the assembly language representation will be slightly different, but the language isn't hiding anything behind an abstraction. Contrast that to, say, Pascal where the length of the string is hidden from the developer and can only be accessed through function calls. (It probably should be, but that is beside the point.)
- pjmlp 2y agoDepending on the Pascal implementation, the length might be accessible actually, but better not mess directly with it.
- pjmlp 2y agoThe usual C mythology continuously spread since the mists of UNIX epoch.
- gf000 2y ago> one that's just a notch above the assembler. That has never been true, unless you are writing programs against a PDP-11. C compilers can change even the O complexity of your algorithms, it's nowhere close to assembly.
- teo_zero 2y ago> C compilers can change even the O complexity of your algorithms I'd be curious to see an example...
- WalterBright 2y agoMy proposal https://www.digitalmars.com/articles/C-biggest-mistake.html https://www.digitalmars.com/articles/C-biggest-mistake.html does not take anything away from C's low level abilities.