8 ms·
They must have got something good though. Else why would there entire families of C-like languages ? Plus, to me C syntax is particularly good. You're writing
by jrimbault 9y ago
They must have got something good though. Else why would there entire families of C-like languages ?
Plus, to me C syntax is particularly good. You're writing real words and the computers does the things you tell it to. To the letter.
- jschwartzi 9y agoThe nice thing about C is that it's a great cross-platform assembly language. I wouldn't call its syntax good or bad.
- emmelaich 9y agoExactly. If C hadn't been invented then someone would have invented it later under a different name. Because it's obvious people need a minimalistic portable assembler.
- pjmlp 9y agoBefore C was invented there were already other companies writing OSes in high level languages, but yeah thanks to its victory now it gets all the credits. History is re-written by winners as usual.
- emmelaich 9y agoI wasn't thinking in terms of winners. But what were those other OSs and languages? Sounds interesting!
- pjmlp 9y agoYou can start here, https://en.wikipedia.org/wiki/System_programming_language https://en.wikipedia.org/wiki/System_programming_language https://en.wikipedia.org/wiki/Category:Systems_programming_languages https://en.wikipedia.org/wiki/Category:Systems_programming_l... Some examples, out of my head. - Burroughs, now being sold as Unisys ClearCase, used ESPOL, later replaced by NEWP, which already used the concept of UNSAFE code blocks; - IBM used PL/8 for their RISC research, before switching to C, when they decide to go commercial selling RISC hardware for UNIX workstations - VAX/VMS used Bliss - Xerox PARC started their research in BCPL, eventually moved to Mesa (later upgraded to Mesa/Cedar), these languages are the inspiration for Wirth's Modula-2 and Oberon languages - OS/400, nowadays known as IBM i, was developed in PL/S. New code started to be replaced by C++. It was probably the first OS to use a kernel level JIT with a portable bytecode for its executables. BitSavers and Archive web sites are full of scanned papers and manuals from these and other systems.
- wtetzner 9y ago> The nice thing about C is that it's a great cross-platform assembly language. I wouldn't call its syntax good or bad. Is it though? It's definitely available on a huge number of platforms, but are the implementations compatible? And even if they are, there is so much undefined behavior that taking advantage of the cross-platform nature is not nearly as easy as it should be.
- jimktrains2 9y ago> They must have got something good though. Else why would there entire families of C-like languages ? Network effect. If you wanted to write for unix, you almost had to use C originally. > Plus, to me C syntax is particularly good. It's meh. It's not the most straightforward when defining complex types like arrays or function pointers. > You're writing real words and the computers does the things you tell it to. To the letter. So yeah, about that...
- jstimpfle 9y agoEverybody I know found it confusing at first, but its logical, and modular. I don't know a language with a better type declaration syntax. It gets impractical when you define function that return functions that return... because these expression grow on the left and right simultaneously. But realistically, you don't do that in C, and other than that, I find it easy to read the type of any expression... const int *x[5]; *x[3]; // const int x[3]; // const int * x; // ok - there is first a decay of x[5] to *x, so: const int ** Is there any other syntax that has this modularity?
- kstrauser 9y ago> But realistically, you don't do that in C IMHO, that's a self-fulfilling prophecy. If it were reasonably easy to do that in C, it would be done more.
- YSFEJ4SWJUVU6 9y agoIt is quite reasonably easy enough compared to any real practical programming task. For example: // your ordinary function declarations int plus2(int i) { return i + 2; } int times2(int i) { return i * 2; } typedef int (*modfun)(int); // a very reasonable syntax altogether modfun get_modfun(bool mul) { return (mul ? times2 : plus2); } Nests as well if you ever wanted to: modfun get_modfun_no_mul(bool mul) { return plus2; } typedef modfun (*modfun_getter)(bool); modfun_getter get_getter(bool allow_mul_opt) { return (allow_mul_opt ? get_modfun : get_modfun_no_mul); }
- 9y ago
- kibwen 9y ago> Else why would there entire families of C-like languages ? C became popular because Unix became popular, and when designing a language that intends to become popular one aims for a ratio of 10% novelty and 90% familiarity. Like, ever wonder why Javascript's date format numbers the months starting from zero and the days starting from one? It's because Eich was told to make JS as much like Java as he could, and java.util.Date numbers the months from zero and the days from one, which Java itself got from C's time.h. (Not coincidentally, Java and JS are both in the C-like language family.) > You're writing real words In C? Not compared to ALGOL, COBOL, Pascal, and Ada, you're not. :) > the computers does the things you tell it to. To the letter. As long as you're not using a modern compiler, whose optimizations will gleefully translate your code into whatever operations it pleases. And even if one were to bypass C and write assembly code manually, that still doesn't give you complete control over modern CPUs, who are free to do all sorts of opaque silliness in the background for the sake of performance.
- jrimbault 9y agoTo be fair with myself I was mostly snarking around op comment who dismissed the C language as if it was some ancient relic. But even without accounting for compiler optimizations and cpu architecture, the C language just straight up lies to its user. You could code something entirely with void*. PS: what I meant by "real words" is that you're naming functions and calling them by their name. Which in itself is very powerful.
- ZenoArrow 9y agoI've got no issue with C syntax either, but to be clear, syntax != semantics. To cut to the chase: * syntax = structure * semantics = meaning C syntax would include things like curly braces and semicolons, whereas C semantics would include things like the functionality of the reserved keywords. This SO answer gives a more detailed explanation: https://stackoverflow.com/a/17931183/1863924 https://stackoverflow.com/a/17931183/1863924
- Retra 9y agoMost languages become popular because they have a reputation of necessity. Which is to say, they are popular due to marketing, not due to quality. (As most things are.)