Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

High Level Programming Languages

Name: Anonymous 2013-09-07 16:38

When is it appropriate to use a high level programming language? Personally, I always feel guilty when using anything except C.

Name: Anonymous 2013-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.

Name: Anonymous 2013-09-07 16:56

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: Anonymous 2013-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: Anonymous 2013-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.

>>3
Then test systems for that. Valgrind, cgdb, DynamoRIO, etc.:
https://en.wikipedia.org/wiki/Dynamic_program_analysis
https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis
There was a FreeBSD one is used to use allot, but forgot the name. Its trusted across many companies, including IBM and Oracle.

However, you can also use Dependently typed languages:
Coq, ATS, Agda, etc.

Name: Anonymous 2013-09-07 17:53

>>4
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).

>>5
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: Anonymous 2013-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: Anonymous 2013-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: >>5 2013-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.

>>7
Check out ATS then.

Name: Anonymous 2013-09-07 20:18

>>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: Anonymous 2013-09-07 20:24

>>7
What's with this ``reinvent the wheel'' fascination both positive and negative in the programming world?

Name: Anonymous 2013-09-07 20:29

>>11
Stockholm syndrome.

Name: Anonymous 2013-09-07 20:51

>>11
It's just a common metaphor that describes the problem accurately enough.

Name: Anonymous 2013-09-07 20:59

>>13
But there is nothing wrong with reinventing the wheel. If people like you were the majority we'd still be in the stone age.
Reinvent everything.

Name: DNRY 2013-09-07 21:09

>>14
That makes no sense. >>13 never advocated reinvention. I assume what you meant to say was that "there's nothing wrong with improving wheels."

--藍染 惣右介

Name: Anonymous 2013-09-07 21:51

>>15
Reading comprehension problems?

>>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/ DNRY 2013-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.

--カール·セーガン

Name: Anonymous 2013-09-07 22:14

>>17
I feel like I'm being trolled.

Name: CRUD 2013-09-07 22:30

>>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: Anonymous 2016-03-21 16:23

Never.

Name: Anonymous 2016-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.

Name: Anonymous 2016-03-22 14:05

>>20
>>21
Check 'em

Name: Anonymous 2016-03-22 14:17

>>22
I have checked 'em and they're very unoptimized!

Name: Anonymous 2016-03-22 18:43

I feel guilty whenever I have to resort to using a low level language.

Name: Anonymous 2016-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: Anonymous 2016-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: Anonymous 2016-03-23 15:59

>>26
There's a reason the wheel inventors are called primitives

Name: Anonymous 2017-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: Anonymous 2017-04-05 4:37

>>28
But that's because it made sense for the 18-bit machines.

Name: Anonymous 2017-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

Name: Anonymous 2017-04-05 9:14

>>30
C isn't low level.

Name: Anonymous 2017-04-05 9:37

>>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.

Name: Anonymous 2017-04-05 10:17

>>30
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.

>>32
Well, C is simple and has low-level features.
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.

Name: Anonymous 2017-04-05 12:32

dd

Name: Anonymous 2017-04-05 13:47

>>33
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: Anonymous 2017-04-05 18:57

Its amazing people think of asm as alternative to C.

Name: Anonymous 2017-04-06 0:27

>>8
run anywhere with no dependencies, and no runtime requirements.

This is what C programmers actually believe

Name: Anonymous 2017-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: Anonymous 2017-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.

Name: Anonymous 2017-04-07 17:59

>>39
Amen

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List