When is it appropriate to use a high level programming language? Personally, I always feel guilty when using anything except C.
Name:
Anonymous2013-09-07 16:48
C is still a high level language. It's just not "as high level" as the other garbage.
YA AIN'T READ DA STANDARD.
While C allows direct access to the machine and reveals many details of the implementation, assuming it of the language is not technically right. C can even be interpreted, if you so desire. The automatic variables can be implemented as hash tables, etc.
I also use C most of the time, though. Everything else feels uncomfortable.
If and only if the said high level programming language protects you against data structure corruption (e.g. buffer overflows). Because computer security is more important than anything else.
Name:
Anonymous2013-09-07 17:17
>>3 But just because the language prevents you from shooting yourself in the foot at a memory level, it doesn't mean you'll code any more securely. You can still make errors in the logic itself. Furthermore, the best way to maintain security is to reduce or avoid complexity. Low level languages have simple implementation. There isn't a fundamental flaw in their translation, and any exploitation of programs in such a language relies more on the Operating System itself. Compare that to Java and its VM.
Name:
Anonymous2013-09-07 17:23
>>1 Just use a compiler that translates the code into C. Chicken(Scheme) does that very well. No need to be ashamed.
>>2 I wholeheartedly agree, esp. if you got started on C first.
But just because the language prevents you from shooting yourself in the foot at a memory level, it doesn't mean you'll code any more securely. You can still make errors in the logic itself.
Yes, but in a higher level language (at least in one that isn't shit), you can hope that the added expressiveness will eliminate redundancy, thus allowing you to better concentrate on the logic. Logic errors are also easier to notice than accidental off-by-ones or footnote-of-manpage errors.
Furthermore, the best way to maintain security is to reduce or avoid complexity. There isn't a fundamental flaw in their translation, and any exploitation of programs in such a language relies more on the Operating System itself. Compare that to Java and its VM.
Not necessarily. JVM is a great example of how not to do anything, so bringing it up is pointless. As for complexity, most [s]Lisp[/s] anything interpreters out there are far far simpler than clang or, god forbid, gcc. My ideal platform would be one in which code is by default interpreted, and sometimes JITted into native code which is then checked by a static checker (which should be an easier problem than the usual halting-complete version since the JITC will only output a very specific subset of the possible ``native code'' programs).
Then test systems for that. Valgrind, cgdb, DynamoRIO, etc.
They're imperfect. So far automatic theorem provers aren't strong enough to prove the correctness of sufficiently-large-to-be-useful programs, so they give up on exploring beyond certain branching points.
However, Dependently typed languages
Those are horrible and you know it.
Name:
Anonymous2013-09-07 17:57
It should be asked the other way around: When is it appropriate to use C?
You have no real reason to reinvent the wheel unless you need a slightly modified or faster one.
Name:
Anonymous2013-09-07 18:01
>>7 I want something that can run anywhere with no dependencies, and no runtime requirements.
C is basically the only sane language that allows this.
Name:
>>52013-09-07 18:45
>>6 There more options as provided, and the one that is giving me trouble recalling the name, tests its validity and known exploits on our database.
And no, Dependently typed languages are awesome. You make your own type checking system, to make a error tolerant system via proofs in C, Scheme, and Haskell.
>>1 Somewhere or other I saw a programming evaluation used across languages. C programmers on average produced slower-running implementations than Java (!) programmers and took longer to do it. Peter Norvig did a lisp version faster and better as did I in C# (with appropriate shame). So to answer your question, don't use c if you are 1. incompetent or 2. in too much of a hurry to bother with optimization.
Name:
Anonymous2013-09-07 20:24
>>7 What's with this ``reinvent the wheel'' fascination both positive and negative in the programming world?
>>14 advocates reinvention. Often reinvention helps improvement. Reinvention also improves the programmer, as there's usually no way to truly or intuitively understand a system without actually implementing it.
Name:
KISS w/ DNRY2013-09-07 22:08
>>16 No, I can read well enough. If >>13 was FOR reinvention, we would still be creating wheels, and no carts would have been ever made. We would be in the stone age. But since he is against it, we have aeroplanes and submarines.
What you want is improvement, upgrading, branching, etc. Nature itself evolves, ever meliorating.
But of course, part of improving as a developer is to build and rebuild existing systems. Just like building a house. A constructor has to repeat the process of setting the foundation, raising the walls, and placing a roof, with changes based on the environment.
>>18 My apologies for my mistake: s/developer/coder/ The job of a developer is to design, always improving a system. The job of a coder is that of a constructor. I used the incorrect word. as /prog/rammers, we do both. Thus we are stuck on that endless cycle of improving our systems, and reinvent things to discipline ourselves.
—マーク·トウェイン
Name:
Anonymous2016-03-21 16:23
Never.
Name:
Anonymous2016-03-22 4:30
Always.
HLLs are a good way to build up assembly code, too (or C, lol portable assembly). You already know what the asm should do, but it's not worth the time to fiddle around with all the instructions by hand. Teach the machine to do it for you, while still watching the generation of the assembly itself.
>>22 I have checked 'em and they're very unoptimized!
Name:
Anonymous2016-03-22 18:43
I feel guilty whenever I have to resort to using a low level language.
Name:
Anonymous2016-03-22 19:03
Don't reinvent the wheel is code for use my black box without understanding it. This sort of thinking raised a generation of morons who don't know what they're doing.
Name:
Anonymous2016-03-23 12:23
If the wheel was never reinvented, our wheels would still be made of stone and lopsided, and cars would fly off the road if they went faster than 30 mph.
Name:
Anonymous2016-03-23 15:59
>>26 There's a reason the wheel inventors are called primitives
Name:
Anonymous2017-04-04 4:29
C is high level, but low quality. Noobs think putting 0 in front of a number makes it octal because it's low level. No, it's because it was created by retards.
Name:
Anonymous2017-04-05 4:37
>>28 But that's because it made sense for the 18-bit machines.
Name:
Anonymous2017-04-05 7:50
>>1 When i write C i write serious, long-term stuff that should use 100% of the machine cycles. When the performance is secondary, anything else is fine. C allows you to write at minimal abstraction level, thats why it feels more natural, since its simple. Speed, Safety, Simplicity are like a triangle where you can't have all three: Speed+Simplicity=Low-level Languages like C Speed+Safety=Safety-Critical software like Ada Safety+Simplicity=Functional programming
>>31 Well, C is simple and has low-level features. C being high-level usually means "Lisp compiles to C code that would be impractical to write manually", that is C has the option of being at any level of abstraction, if programming time isn't a problem its possible to reimplement anything in C. However because C binds to low-level idioms easily, its used as low-level byte twiddling tool more than anything complex.
When i write C i write serious, long-term stuff that should use 100% of the machine cycles.
You need an optimizing compiler just to be able to use basic CPU instructions. It's more work for you and the compiler. It makes compilers more bloated and harder to maintain. Compilers are bigger so you can write more code to do the same thing you can do in other languages with a smaller compiler and less code. It's stupid for serious stuff, like using Brainfuck.
C allows you to write at minimal abstraction level, thats why it feels more natural, since its simple.
You obviously never wrote any assembly. C is a terrible language for most machines because it has less features than the hardware. It's crap. C compilers have to turn whole loops into single instructions. Some of those optimizations depend on undefined behavior in C, which is well-defined in your CPU, so your code can turn into garbage.
It has pointers. That is the only low level thing about C. C is not low level, but crippled. You can't use arrays without resorting to unsafe pointers. That's why C can't have bounds checking without bloating up every pointer in the program. C pointers are less safe than assembly pointers because they are not machine addresses. All of those optimizations make pointers dangerous.
"Lisp compiles to C code that would be impractical to write manually"
Someone made a Basic to Brainfuck compiler. That Brainfuck would be impractical to write manually. Wanting to compile to it so you don't have to use it means the language is bad, but it doesn't mean it's low level. Look at the JavaScript "transpilers" everyone is making so they don't have to use JavaScript.
C has the option of being at any level of abstraction, if programming time isn't a problem its possible to reimplement anything in C.
Brainfuck has the option of being at any level of abstraction, if programming time and code size aren't problems, it's possible to reimplement anything in Brainfuck.
C is a terrible language for most machines because it has less features than the hardware.
Yeah, I had to learn this the hard way when I wrote a toy bignum library. It turns out C has no way to access carries generated by multiplication, so if you want them, you have to either use a type twice the size or calculate the carry yourself using long multiplication, which incurs three extra multiplications. Division got a stdlib function that gives you quotient and remainder, but a defense against multiplication overflow wasn't worth anyone's time? Thanks to patterns like ptr = malloc(width*length*height);, you can easily get memory corruption from an overflow like that.
It's amazing how somebody can think C is well-designed or appropriate for anything nowadays.
Name:
Anonymous2017-04-05 18:57
Its amazing people think of asm as alternative to C.
run anywhere with no dependencies, and no runtime requirements.
This is what C programmers actually believe
Name:
Anonymous2017-04-07 17:33
People wishing to excell in a 20-30 year old discussion.
While good points were made. They were so by application programmers (probably) with their favorite JIT,scriptmachine,entire OS', et cetera, implemented in C.
Name:
Anonymous2017-04-07 17:46
>>33 "You obviously never wrote any assembly. C is a terrible language for most machines because it has less features than the hardware. It's crap. C compilers have to turn whole loops into single instructions. Some of those optimizations depend on undefined behavior in C, which is well-defined in your CPU, so your code can turn into garbage."
Show me how your favorite elegance of a language resolves to these machine features that C supposedly lacks interface to. That your language has big numbers implemented on top of GMP is not going to make your point.
C is not supposed to interface with the machine, the likes assembly language does. Nor is Erlang,Any of the LISP, the JVM et cetera. That is a compilers duty. As for compilers, I think the C and C++ ones take the prize...
C is a good language, among others. It just has more tradition than some.
>>38 I'll have you know my OS was written in LISP.
Name:
Anonymous2017-04-08 11:28
>>39 I thought long and hard about replying to this seriously, but the post is utterly schizophrenic.
What do you mean C lacks interfaces to machine features? It doesn't, and if it does that's fine too because it was never supposed to have them! How would your language do it, huh? No, libraries don't count because they would prove me wrong. C is truly a great language despite lacking basic low-level and high-level features.
Ridiculous.
Name:
Anonymous2017-04-08 17:45
>>42 You're ridicilous. You're being sarcastic on my behalf as an attempt to make a point of your own. Your satire is wrong and you're not making a point perhaps other than that you don't understand computing.
You could've asked for clarifications but you didn't. I hope you understand that you're not eligible for discussions here.
Name:
Anonymous2017-04-08 18:11
>>43 What is there to clarify? You are barely saying anything and what little you say contradicts itself or is straight-up kindergarten shit like ``this argument doesn't count because I say so''.
Name:
Anonymous2017-04-08 21:50
->>44 You're the one actually not saying anything here pal. By being sarcastic and rude you illustrate your own allegation ``this argument doesn't count because I say so''.
Rhetorically I state, about other languages, it is often true that they are bootstrapped in C or implement features in C. Such as GMP for bignum. Many languages are also directly translated to C. This is because the creators (as opposed to the fanboys) probably found C useful in this.
I am merely pointing out the nonsense in saying C is crap despite the fact that most of what you people idealize is implemented with it.
I also say it's the compilers purpose to efficiently interface the CPU. Do you deny this? Why are there different compilers for different architectures?
I'm not saying any language is worse or better actually - YOU ARE - but yeah sure, I like C. I don't dislike any particular language. I acknowledge that application programming languages are more proper to many tasks, but you people who is constantly bashing C in favor of your 1%-language need some serious help with reality.
I think C is a good language exactly because it is not low-level, while it is also not high-level. So there you are right in your clowing around ;).
Last but not least, the best language is the one you're actually productive in and works for you.
Name:
Anonymous2017-04-09 11:45
>>45 What a language is implemented in is completely irrelevant in a discussion of languages because no matter how much the implementation changes, the language stays the same. On Lisp operating systems, C was implemented on top of Lisp. Does that mean Lisp is the better low-level language? If it doesn't, why should it mean anything with the roles reversed? Current operating systems are C operating systems after all. A monoculture doesn't make a system better, it just hides its flaws under a mountain of resources. You could use the same non-argument to ``show'' that PHP is a great language for web development even though it is a major source of errors and there has never been a single fully correct program written in it. Indeed, PHP toiletscrubbers employ the same rhetorical tricks, including the one where ``the best language is the language you know'', which is not a point about languages but about your own lack of knowledge.
I also say it's the compilers purpose to efficiently interface the CPU.
Nobody argues that a language other than assembly should directly expose hardware-specifics. The C compiler has a harder job here because it must recognize patterns in a weak language rather than break down high-level statements.
I think C is a good language exactly because it is not low-level, while it is also not high-level.
What purpose does it serve if it does nothing well?
>>46 Look. I believe you are quite proficient and enthusiastic about the LISPs. And what constitutes a good language, by ideal, you probably make a very good judge.
I like C due to its machinerealism. It is what has enabled it to become the most ported language, with the most ported software. It is not a mistake.
I like that C offers control structures and a reasonabel memorymodel. I feel like C is very intuitive and I feel the same way about Assembly language.
It's intermediate level (not low, not high) is a *necessity* to achive machine independency. You think undefined behavior is a mistake, I think it is reality.
And in the case were we like to take advantage of uncommon (not as in rare, but as in peculiarity) machine features we merely extend a program with something like e.g. intel_aesni.S, intel_rdrand.S, while the rest is plain C.
I realized this discussion is actually older than both C and LISP. This is no different from the rationalism v. realism in continental philosophy. If you demand me a longer answer I will return with one. But I don't think it is of any use (and I lost interest).
Name:
Anonymous2017-04-12 21:01
>>48 Author here. *Reasonable memory model (typo).
Name:
Anonymous2017-04-13 15:11
Protip:Attacking C as a language is much more effective when you present actual flaws instead of abstract design choices that backward compatibility requires.
Name:
Anonymous2017-04-13 21:33
>>50 A flaw doesn't stop being a flaw just because you call it a design choice and put it into cement.
Name:
Anonymous2017-04-17 20:59
When is it appropriate to use a high level programming language?
More like, "when is it appropriate not to use one."
Name:
Anonymous2017-04-18 15:17
1.writing stuff that needs to be written fast: rapid prototypes, scripts and utilities for rare use. 2.Demos and concept programs, code which doesn't need performance. 3.High-integrity software: C is too unsafe for it. C is still the lingua franca of computing. Its like Latin at this point: more advanced and precises languages exist but C provides universal basis for writing new stuff(compilers, VM, interpreters). At the root of most software stacks there is a C/C++ dependency(where C++ being dependent on C-level components and libraries)
Name:
Anonymous2017-04-22 16:03
>>53 Now when is it appropriate not to use high level programming languages?
Name:
Anonymous2017-04-23 11:32
>>54 Anywhere where performance and memory matter? Embedded, Mobile, Internet of things, routers, appliances, microservers, small business who can't afford clusters of servers, basically even web apps if you value performance/memory use above the 'programmer time' meme.
Name:
Anonymous2017-04-23 14:38
>>55 You don't want to use C for any of those. C is garbage. Everything written in C is junk and full of bugs and security vulnerabilities. Small businesses that use C and end up with buffer overflows and getting their customers' credit card numbers leaked won't be in business very long. Null-terminated strings would eliminate the performance increases from using C in the first place.
There are languages that are faster than C and also nicer to use. Not using C doesn't mean using C++, Lisp, Java, or scripting languages.
Name:
Anonymous2017-04-24 12:23
>There are languages that are faster than C and also nicer to use Not aware of any? Are you referring to rigged Rust benchmarks? Rust isn't nice to use in anyway, its borrow checking autism and paranoia don't allow you to "just code it in".
>>56 Maybe if you wrote the programs, maybe then they are garbage.
I know a lot of great C code. You probably don't even know C code. How did you all get so freaking mad about C anyway?
Many serious pieces of software, a lot of software to create a supportive environment for further abstracted software is implemented with C. And then there are typically small bootstrapping / supporting collections of programs beneath C, in machine code, to supplement in areas where abstractions just isn't sustainable. This is REALITY, and for very good reasons it is so. Because the founders of modern computing made it that way. Are you unhappy with this? Is their work garbage?
And all you have to say about that is "undefined behavior!!!". But so what? Undefined behavior could very well be what makes C great. But you wouldn't understand any of that because instead of programming and proving that YOU are a capable programmer, in whatever language suits your preferences, you probably don't account for sh*t and to hide this fact you indulge in these endless discussions and futile reasoning about what language is better and what language is garbage. This is what a lot of people refer to as "babble", "bullshit". Charlatan.
I shouldn't even have opened my mouth but I admit I was baited. To all the other programmers who simply mind their own business let me just say this: Obviously I am a C programmer, and I enjoy C, I also think C is beautiful. I DON'T think it's LIPS however, and hands down I never read SICP.
You may not agree with C being the great language I percieve it. I think many of you don't, some of you do. Whatever. If you don't you are free to pick ANY OTHER LANGUAGE and I will respect your choice. If you think it's a good language, and you're productive with it, there has to be something to it. I expect the same from you.
So, is there going to be a real discussion about programming languages? Maybe people will share interesting ideas, personal philosophical views et cetera? Will there? Cause simply saying something is "garbage" is not discussion.
Name:
Anonymous2017-04-25 7:27
>>64 It might be a great language, but it doesn't mean it should be used everywhere. People talk about the performance impact as if using C will be 1,000,000 times faster than other programming languages.
I know a lot of great C code. You probably don't even know C code. How did you all get so freaking mad about C anyway?
Code by professionals =/= Code done by code monkeys.
Name:
Anonymous2017-04-25 11:48
>>65 People are generally idiots and so are you if you believe unbacked claims.
Name:
Anonymous2017-04-25 15:04
>>65 The thing is if C is even x10 faster(with inlime asm highly likely) the benefits and safety of using high-level language evaporate. Imagine 1.You have software that does task X 2.You can run X in Y time or use Z-language with 10*Y runtime 3.Z is safer and more reliable, but it will need x10 the hardware cost or if its parallelisable x10 servers. 4.It will cost significantly more to use Z in real world, then to test and debug X. Z-language will remain superior and more reliable, but it won't help in this case, and many cases of performance/memory limits hints hardware decide the software, rather than the opposite. In Z-language land everyone is blessed with dual-xeon/Titans setups but normal people can't afford that shit, and businesses/companies/etc don't want to waste money too. The result is lots of C and asm, micro-optimizations that bring 0.1% faster code and save 0.1% of datacenter costs. The only real alternative to C is ada/spark, which requires much more development time to get the same speed as C programmers gain from a few hours of optimizing a piece of code. So in summary fast/cheap/unsafe C/C++ code is often the optimal solution in many business and research needs. It would be nice if everyone switched to something safer but there are tradeoffs they don't realize, making languages other than C or C++ less viable, while C deficiencies are fixed by libraries having features from these languages.
Name:
Anonymous2017-04-25 15:48
>>68 I'm pretty sure not many companies reach that scenario.
Name:
Anonymous2017-04-25 15:54
>>69 Companies that neglect performance of their crucial code pay for it with more hardware costs. Its worse for smaller companies and startups who write code fast and fix the performance later. At some point the demand/use of software uncovers the lower hardware limits and the company is forced to buy more servers(lowering profits) or refactor the software(introducing new bugs or quirks), both of which sap its valuable development time when competitors and mainstream corporations take interests.
Many serious pieces of software, a lot of software to create a supportive environment for further abstracted software is implemented with C.
That's why programming sucks. It's always the C parts that make software buggy and exploitable. If the OS language was better, we wouldn't need so many scripting languages in the first place.
Because the founders of modern computing made it that way.
The C (and Unix) founders are not the founders of modern computing. Pretty much everything was poorly copied from Multics. They worked on Multics too, but Unix is like Multics: the bad parts or --Multics (decrement and return less value than before). That's why it's called Unix, as a pun on Multics and Eunuchs.
Everything based on C is garbage. The world would be a better place if C never existed. If Microsoft didn't pick C for writing Windows, you wouldn't even be having this discussion. C would be a dead language used only by Plan 9 and BSD hobbyists. Unix was dying in the 90s anyway and would be completely gone if not for GNU/Linux.
Undefined behavior could very well be what makes C great.
Crime could very well be what makes the ghetto great. People choose to live there because of the crime. People choose to use C-based operating systems because of the bugs.
Obviously I am a C programmer, and I enjoy C, I also think C is beautiful.
If you're smarter than Dennis Ritchie, Linus Torvalds, Richard Stallman, Theo De Raadt, Brian Kernighan, Rob Pike, and everyone else who ever used C, then you might be able to write C, otherwise you're just a poseur. These people can't write safe programs in C, but you think you can?
Name:
Anonymous2017-04-25 21:04
>>68 A ten-fold performance improvement is a fucking ludicrous scenario unless you are writing number crunching code and in that case you can just write the crucial sections in C or asm (or more likely, use a library written in it). On that note, why do cetards always count inline assembly as a part of their language? It is completely non-standard and discouraged in normal code. You don't see Haskal folks bragging about performance gains from the FFI either.
Name:
Anonymous2017-04-25 21:29
>>72 They also act like C is the only language with inline assembly.
Name:
Anonymous2017-04-30 0:48
>>71 You could just as well make these arguments against the hardware design and manufacture which are also "to blame" for unsafe execution. I think i can write safe code in C, and I'm also certain that safe C-code isn't all that rare. Unsafe C-code isn't rare either. What's your point? This is the reality of programling, something you should stay away from if you don't enjoy the challenge. No one language is going to solve the issues you mention. No one language had and no one language will. Undefined behavior, unsafe execution et cetera is what makes C practical in it's application. And it is typical that people like you don't understand this.
And then a lot of your points are just plain wrong.
Now it happens to be like this, I have some exciting projects coming up with a friend and I'll spend my time programming with C rather than waste my time in this incredibly stupid topic. I'm actually going to have fun. Spend your time with your equally confused C-fanatics in this forum. You and them are a match.
>>74 It should be easy to provide an example of safe C code in that case, but instead you retreat, complete with the cliché ``i'll have fun in my real life, nerd''. You wouldn't even bet your reputation on an anonymous board on the safety of C.
Name:
Anonymous2017-05-07 21:30
>>75 "The safety of C" is something you guys have been bringing up. You're the ones making a fanatic deal about it. Not me. I'm just saying it isn't as "unsafe" (or "safe"). I think however it is perfectly fine in this regard. I acknowledge there is vulnerable C code (so what?). I can not currently think of one attack vector against C programs that is thoroughly to attribute to the language design of C. While there are some (always exaggerated) examples of obviously unsafe utilizations of C most critical vulnerabilities in computing also has ties to OS design and implementation, architectural design and conventions, et cetera. Any serious programmer realizes this.
And I find this discussion pathetic. It's not a retreat when I simply don't want to spend too much time arguing over this.
>>76 I really can't tell whether this is master-level trolling or a legit C fanboy going through mental gymnastics to the point he believes his own sleighs of hand. Whatever it is, I'm impressed, holy fuck.
Name:
Anonymous2017-05-08 0:33
What exactly do the anti-C bigots suggest be used instead? It's not like there's a plausible alternative for writing kernels and drivers in, unless you want to go back to assembly language.
>>1 I'm tired of this bullshit, fuck everything you just said. C is just a bad high level programming language, calling it a low level language is just pure fucking bullshit spout by mindless UNIX retards. That 700+ pages long inconsistent standard that underdefines the bad pretense of a programming language known as C is nowhere usable for low level programming. When programming at low level, EVERY case MUST be specified, none of that "lol this is undefined behavior" traps that are so common in C and are a major source of bugs just like the completely retarded implicit integer promotion/demotion rules, you MUST have control over the machine, which absolutely does NOT mean "look at me, I can do pointers! I allocate and free memory with unsafe operations, so low level amirite?", but to be able to manipulate the stack, read and write registers and flags, and, you know, actual low level stuff. And you can have type safe, memory safe low level language, just look at typed assemblies, those are low level languages, HLAs are "syntactic sugar for assembly", not C. And don't fucking get me started with that portable assembly crap.
Name:
Anonymous2017-06-17 20:22
>>91 Is there a better candidate for the title of ``low-level compiled language"?