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

Alternatives to C/C++

Name: Anonymous 2010-07-18 6:04

Instead of sticking with C/C++ for performance consider:
1.Free Pascal -Small memory use,very fast, easy debug
2.OCaml - medium memory use, fast,very terse, functional and secure.
3.FreeBasic - very fast,easy to use, low memory use, supports QBasic code as dialect. Other Basics to consider: PureBasic/Gambas/PowerBASIC
4.Digital Mars D- fast, easy to write and debug, large library, transition from C/C++ much easier.Garbage collection can be turned off.

Name: Expert C programmer 2010-07-19 0:51

>>40
too late because my version of FreePascal is already used for app development.

Name: Anonymous 2010-07-19 3:09

Why people program drivers in C when pascal has much easier interface?
http://www.freepascal.org/docs-html/rtl/video/viddriver.html

Name: Anonymous 2010-07-19 4:43

>>42
Feels like its 94' and SuperVGA is cutting edge.

Name: Anonymous 2010-07-19 5:11

People who still program in Pascal and use FreePascal are like conspiracy theorists. No matter how much evidence you show them to the contrary, they'll continue to stick to their beliefs, and in fact will do so more fiercely.

It's best to leave them to their toy language.

Name: Anonymous 2010-07-19 6:40

>>44
What exactly is wrong with Pascal? You can do pretty much anything in it, but that doesn't mean that it's not just a more restricted C with a simple object system and more verbose syntax. There is little reason to use it these days, but people usually do because they know it(it's thought in some countries in schools, which makes it as a sort of poor man's Java, but more low-level). It's used for the same reason BASIC(and derivatives) are used: people know it because it was the first language they tried. It's not completly terrible, but there are many better options out there.

Name: Anonymous 2010-07-19 7:31

>>45
There is little reason to use it these days
Consider me offended

You're an academician, my friend. Name me a language that can compile to native code on a decently wide scale of popular architectures

Now tell me if those languages provide equally crossplatform lowlevel tools that are useful in daily life(threading and synchronization, atomic operations, automatically converted codepaged "unlimited" length strings, possibility of almost pure object oriented programming)

Java? Don't make me laugh
C? Not a chance. Too inbred with UNIX
C++? God dammit, what a disaster? Something as simple as atomic operations. I don't want to code them in assembler for any platform I come to
C#? Well, it's getting there but it's still a botched syntax, designed to cater to brain dead american university students

If only Lisp machines still existed. Then Object Pascal would have had a worthy opponent

Yes, I mad

Name: Anonymous 2010-07-19 8:05

Try HTML PROGRAMMING, software is now delivered through the browser.

Name: Anonymous 2010-07-19 8:14

>>46
What if Lisp machines are outdated? There are plenty of real Lisp implementations ported to a variety of platforms.

So far Common Lisp + defacto standards seems to fit your goals, but the language is quite high-level. If you want low-level you have to limit yourself to an implementation or use an FFI, which brings you back to (inline or external) assembly or C.

Name: Anonymous 2010-07-19 9:27

The only real choice for performance is D, though you have to rewrite to avoid garbage collection and use (mostly) C-level abstractions.

Name: Anonymous 2010-07-19 15:23

>>49
That's probably why people are still writing C. The sad thing is you don't need to be scared of automatic GC, so long as you can keep it from stu tte rin g.

Name: Anonymous 2010-07-19 15:41

>>50
True.
Just trigger the GC before doing something resource-intensive, shut it off, do your work, turn it back on and collect when you're finished.

In context of a game, you'd explicitly run it during transitions between levels, after a cutscene, etc. There's tons of times when running it won't affect the user experience; people who complain about GC'd languages are naive to think that they're losing any sort of control by letting the computer keep track of allocations. You're actually gaining control and flexibility, because you suddenly don't have to burden yourself with making sure memory is always free()'d when you don't need it anymore but never when you still do. That's a tedious task, and exactly the sort that the computer is better at than the programmer.

Name: Anonymous 2010-07-19 16:19

You can just disable the garbage collector inside the time sensitive parts(and those better be inline assembly) http://stackoverflow.com/questions/472133/turning-off-the-d-garbage-collector

Name: Anonymous 2010-07-19 16:30

>>51
I wouldn't go that far. Manually managing memory is still more efficient and usually more accurate than letting the runtime do it (assuming you don't introduce related bugs), but for safety's sake (i.e. so you don't introduce related bugs) it's not too much to ask.

I've read that malloc can take as long as automatic GC. I'm sure in a worst case vs. best case (respectively) scenario that can happen, but sadly most of the audomatic GC you find is pretty terrible.

Name: Anonymous 2010-07-19 16:40

I've read that malloc can take as long as automatic GC.
Are you are talking about the "GC can be as fast as stack allocation paper" from the 80s?

Name: Anonymous 2010-07-19 17:16

>>54 this?
www.cs.princeton.edu/~appel/papers/45.ps" target='_blank'>http://webcache.googleusercontent.com/search?q=cache:Og6EbMIcJE4J:www.cs.princeton.edu/~appel/papers/45.ps

Name: Anonymous 2010-07-19 18:48

audomatic
I'm having trouble wrapping my head around the mechanics of that typo... anyway...

>>54
I was off. It was this:

http://www.joelonsoftware.com/articles/fog0000000319.html
Eventually, the free chain gets chopped up into little pieces and you ask for a big piece and there are no big pieces available the size you want. So malloc calls a timeout and starts rummaging around the free chain, sorting things out, and merging adjacent small free blocks into larger blocks. This takes 3 1/2 days. The end result of all this mess is that the performance characteristic of malloc is that it's never very fast (it always walks the free chain), and sometimes, unpredictably, it's shockingly slow while it cleans up. (This is, incidentally, the same performance characteristic of garbage collected systems, surprise surprise, so all the claims people make about how garbage collection imposes a performance penalty are not entirely true, since typical malloc implementations had the same kind of performance penalty, albeit milder.)
The claim is not speed, but collection stutter. The problem with this is that calling malloc during RT events (eg. in signal handlers, say... vblank) is verboten, literally incorrect. So your stutter never has an opportunity to happen at the wrong time (with video games don't think Linux, think gaming consoles. Sometimes developers would even use hblank handlers to get more sprites on the screen, or whatever zany effects--with NTSC you have something like ~0.07ms to get the job done.) Compare with Java's GC which (last I had the pleasure) runs whenever the hell it wants, usually long after the program has exhausted its heap and stalled for over an hour (I wish I was joking. Things must have improved by now, yes?)

Even if you aren't in a handler (or re-entrant call or whatever) manual management makes it easy to avoid triggering collection processes at the wrong time. So the characteristic is subtly but fundamentally different because you must decide when to risk collection. I can't stress that enough, but the BBCode is garish enough as it is.

Not to mention the malloc he refers to is old enough that it makes dlmalloc1 look the very picture of sophistication. This lovely little gem is more or less what you get if you use newlib (cygwin, msys), glibc, etc.

Of course you can talk to your GC and tell it when to shut up or prod it to run whenever you want it to and fine tune it this way and that depending on your language, implementation and so on. It's perfectly reasonable to do so, but just because you can doesn't mean it's all been made a non-issue. It's still essentially harder to constrain GC finely in auto-GC languages (at least when using the auto-GC -- though it really doesn't have to be this way, and there may be a few exceptions. Someone is going to say something long and involved about Lisp now. Easy!)

1. http://en.wikipedia.org/wiki/Malloc#dlmalloc_and_its_derivatives

Name: Anonymous 2010-07-19 19:20

>>56
joelonsoftware
That quote can be discounted as invalid for having been written by someone whose primary language is fucking Visual Basic.

Name: Anonymous 2010-07-19 19:26

>>57
herp

Name: Anonymous 2010-07-19 19:32

cocoa

Name: Anonymous 2010-07-19 19:35

>>59
oh gosh

Name: Anonymous 2010-07-19 20:58

>>57
Not really. Read his articles (hell, read that article), he's pretty good at what he does. It might be enterprise but he knows what he's doing. Also, try not to argue from prejudice because the same could be said about you, and for that very reason.

I was disappointed to find him being either ignorant or disingenuous in that particular passage, but it's not like his tone is completely serious. He was arguing for GC, though, and completely missed the use-case scenario in that criticism.

Name: Anonymous 2010-07-19 21:10

>>61
I'm going to pretend you just posted "I like butts", because that's a lot more interesting and insightful than whatever the hell you actually wrote.

Name: Anonymous 2010-07-19 21:19

>>62 is why I don't have kids.

Name: Anonymous 2010-07-19 21:38

>>63
Because they have a low tolerance for bullshit? I don't think you actually know what kids are like.

Name: Anonymous 2010-07-19 21:44

>>64
All I see is
I'm jealous for joelonsoftware

Name: VIPPER 2010-07-19 21:54

>>56
JEWS

Name: Anonymous 2010-07-19 22:23

>>64
Is that what children are like? I'm sorry, you must not be a child then, your tolerance is to being educated.

Why are you here? You don't seem to know anything and you don't seem to want to learn anything. Were you banned from /g/ or something? /v/? /pr/‽

Name: Anonymous 2010-07-20 3:30

"In 1969, AT&T had just terminated their work with the GE/Honeywell/AT&T Multics project. Brian and I had just started working with an early release of Pascal from Professor Nichlaus Wirth's ETH labs in Switzerland and we were impressed with its elegant simplicity and power. Dennis had just finished reading 'Bored of the Rings', a hilarious National Lampoon parody of the great Tolkien 'Lord of the Rings' trilogy. As a lark, we decided to do parodies of the Multics environment and Pascal. Dennis and I were responsible for the operating environment. We looked at Multics and designed the new system to be as complex and cryptic as possible to maximize casual users' frustration levels, calling it Unix as a parody of Multics, as well as other more risqué allusions. Then Dennis and Brian worked on a truly warped version of Pascal, called 'A'. When we found others were actually trying to create real programs with A, we quickly added additional cryptic features and evolved into B, BCPL and finally C.

We stopped when we got a clean compile on the following syntax:
for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("|"+(*u/4) %2);

To think that modern programmers would try to use a language that allowed such a statement was beyond our comprehension! We actually thought of selling this to the Soviets to set their computer science progress back 20 or more years. Imagine our surprise when AT&T and other US corporations actually began trying to use Unix and C! It has taken them 20 years to develop enough expertise to generate even marginally useful applications using this 1960's technological parody, but we are impressed with the tenacity (if not common sense) of the general Unix and C programmer. In any event, Brian, Dennis and I have been working exclusively in Pascal on the Apple Macintosh for the past few years and feel really guilty about the chaos, confusion and truly bad programming that have resulted from our silly prank so long ago."

Name: Anonymous 2010-07-20 4:40

>>68
Lies! Why would they write K&R (and even a 2nd edition) if that were true?

Name: Anonymous 2010-07-20 7:10

>we were impressed with its elegant simplicity and power.
Like a big soviet steam excavator, Pascal is powerful. Its simple too. Somewhat idiot-proof. But elegance? I can't see any.
 Pascal strings, Pascal Arrays, verbosity of cobol, stubborn adherence to rigid and outdated ruleset.

Name: Anonymous 2010-07-20 8:33

>>68
for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("|"+(*u/4) %2);
Valid FV Code

Name: Anonymous 2010-07-20 8:59

>>71

coulder@anonix:/prog$ gfvc prog.fv
bash: gfvc: command not found

Name: Anonymous 2010-07-20 10:21

>>71
I feel kind of bad about that :( Source code is for people to read first, then incidentally for the computer to execute.

Name: Anonymous 2010-07-20 10:28

>>72
Try apt-get install frozen-essential

Name: Anonymous 2010-07-20 10:32

[@:~] apt-get install frozen-essential
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?


Are you root, >>74‍-kun?

Name: Anonymous 2010-07-20 11:18

>>75
Try this:
$ su -
# sudo apt-get install frozen-essential
# sudo reboot

You have to reboot or your computer can crash!!

Name: Anonymous 2010-07-20 12:12

>>75-76
Fucking typical Debian users. You should already know how to install software, do you want to be spoon-fed your whole life?

Name: Anonymous 2010-07-20 12:36

>>76
$ su -
# sudo ...

What?

Name: Anonymous 2010-07-20 12:52

>>77
YHBT. YHL. HAND.

Name: Anonymous 2010-07-20 13:03

>>79
YHABT. YHAL. HAND.

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