News for hackers. Stuff that matters.
Re:C and C++ Prioritize Performance over Correctness by Thiez on Friday August 18, 2023 @03:41PM (#37181049)
In the 1960s they already had languages such as Lisp, Fortran, Algol, Basic... Even Pascal is two years older than C, and ML also came out around that time.

The statement "the alternative to C was assembly" is simply incorrect.

Re:C and C++ Prioritize Performance over Correctness by marcosdumay on Friday August 18, 2023 @04:07PM (#37181384)
On practice those were either proprietary or required beefy machines that the people writing C couldn't get.

On the limited environment where C got created, it was the only option. And everybody suddenly adopted that limited environment, because it was cheap. And then it improved until you could use any of those other languages, but at that point everybody was using C already.

Re:C and C++ Prioritize Performance over Correctness by grumpyprole on Friday August 18, 2023 @04:15PM (#37181493)
IIRC, Mac OS Classic was written in Pascal, as we're other operating systems. C just won the popularity contest.
Re:C and C++ Prioritize Performance over Correctness by marcosdumay on Friday August 18, 2023 @04:51PM (#37181942)
That was about a decade after C had already won.
Re:C and C++ Prioritize Performance over Correctness by grumpyprole on Friday August 18, 2023 @04:58PM (#37182014)
The Xerox Alto was early 70's and that GUI OS was written in Pascal. I always thought Pascal was better designed and less bizarre than C. Null terminated strings were particularly a bad idea.
Re:C and C++ Prioritize Performance over Correctness by marcosdumay on Friday August 18, 2023 @05:27PM (#37182361)
Oh, by 73. Impressive. I didn't know that.

Still, that was a much more powerful machine than the ones people wrote C for. And when the cheap segment of those "fridge computers" became powerful enough to run whatever you wanted to put on it, people started using small workstations. And when those workstations became powerful enough, we got PCs.

It's only when the PCs got powerful enough that we could start to ignore the compiler demands and go with whatever language fit us better. (The later reductions all were based on cross-compiling, so they don't matter here.)

Re:C and C++ Prioritize Performance over Correctness by pjmlp on Saturday August 19, 2023 @04:17AM (#37186672)
Go check the capabilities of systems written in high level languages like ESPOL and NEWP in 1961.

Let not say that a 1961 system is more powerful than a PDP-11.

Re:C and C++ Prioritize Performance over Correctness by mcguire on Friday August 18, 2023 @07:15PM (#37183379)
"Why Pascal is Not My Favorite Programming Language", Brian W. Kernighan, April 2, 1981:

https://www.cs.virginia.edu/~evans/cs655/readings/bwk-on-pas...

One of the major problems, as I recall, was that Wirth's basic Pascal definition was very limited---the max 256 character strings, for example. So the makers of "production" Pascal compilers added extensions to do all of the things that you would want to do and unfortunately those extensions were all incompatible.

Re:C and C++ Prioritize Performance over Correctness by pjmlp on Saturday August 19, 2023 @04:15AM (#37186665)
A famous rant ignoring Pascal dialects, while C still lacked a standard and was a bunch of dialects all over the place.
Re:C and C++ Prioritize Performance over Correctness by mcguire on Saturday August 19, 2023 @04:23PM (#37192776)
I've never seen a C dialect, other than not supporting bit fields. The language was usually the same although the libraries were all over the place.
Re:C and C++ Prioritize Performance over Correctness by pjmlp on Sunday August 20, 2023 @02:42AM (#37196785)
Then you haven't used any C compilers during the CP/M, 8-bit and 16-bit days.

Here are two, RatC, Small-C.

Additionally what do you think GCC C is, in regards to K&R C and ANSI C?

Re:C and C++ Prioritize Performance over Correctness by pjmlp on Saturday August 19, 2023 @04:14AM (#37186661)
Mesa not Pascal.
Re:C and C++ Prioritize Performance over Correctness by grumpyprole on Saturday August 19, 2023 @07:30AM (#37187691)
Yes apologies, I misremembered. Mesa is definitely a decendant of Pascal though, more like Modula-2. Very ahead of its time.
Re:C and C++ Prioritize Performance over Correctness by pjmlp on Saturday August 19, 2023 @09:51AM (#37188793)
Sorry for being a bit pedantic, it predates Modula-2, Niklaus Wirth got in contact with it during his first sabbatical at Xerox PARC, after returning to ETHZ Modula was born, and shortly thereafter Modula-2 and Lillth Workstation, with the OS written in Modula-2.

Several years later, a similar encounter with Mesa's evolution, Mesa/Cedar, gave birth to Oberon.

As for being ahead of its time, very much indeed.

Many people relate to Smalltalk and Interlisp-D, and are unaware of strong typed systems programming at Xerox, with a tooling that only decades cater came to be.

Mesa authors were quite adamant that in order to succeed, Mesa had to support comparable tooling to Smalltalk and Interlisp-D environments.

Re:C and C++ Prioritize Performance over Correctness by StableAlkyne on Friday August 18, 2023 @04:56PM (#37181998)
Fortran predates C by over a decade, and dozens of compilers existed for it by the mid-60s. Much of that legacy code is still in use to this day in scientific computing. One example: John Pople won his Nobel prize for work he did (and implemented in Fortran) in computational chemistry - the prize was delayed until '98 but he did the work in the 60s. The software he commercialized it into, Gaussian, still gets releases to this day and remains one of the most popular computational chemistry packages.

It's really dependent on which field you're in. Not all scientific computing requires a beefy computer, but for a very long time it (and I guess LISP) dominated scientific computing. That said, I think it's a very good point to bring up the network effect of using C - if I need to hire a developer in 1985, it's probably easier to find someone with industry (not academic) experience who knows C than it is to find someone who knows Fortran.

I do kinda prefer Fortran to C though, it's so much cleaner to do math in. Maybe somewhere there's an alternate universe where IBM invented C and Bell invented Fortran to win the popularity war.

Re:C and C++ Prioritize Performance over Correctness by jacquesm on Friday August 18, 2023 @05:07PM (#37182112)
I tried to get access to FORTRAN and it was just way too expensive and required machines that I would not have been able to get close to. C ran on anything from Atari STs, IBM PCs, Amiga's and any other machine that an ordinary person could get their hands on.

The other mainstream language at the time was BASIC, comparable to the way PHP is viewed today by many.

And with the advent of the 32 bit x86 era GCC and djgpp as well as early Linux systems really unlocked a lot of power. Before then you'd have to have access to a VAX or a fancy workstation to get that kind of performance out of PC hardware. It's funny how long it took for the 386 to become fully operational, many years after it was launched you had to jump through all kinds of hoops to be able to use the system properly, whereas on a 68K based system costing a tiny fraction that was considered completely normal.

Re:C and C++ Prioritize Performance over Correctness by StableAlkyne on Friday August 18, 2023 @05:50PM (#37182632)
My perspective is a bit biased by scientific computing, I do more of that than enterprise stuff (and Python has been fine for personal use). It's cool to see the perspective of someone who was around for the early stages of it though.

How did people see Fortran back then - nowadays it's seen as outdated but fast, but was it seen as interesting, and what drove you to seek it out?

Other side question if it's okay, I keep seeing references to VAXen around historical documents and usenet posts from the 80s and 90s, what made them special compared to other hardware you had back then?

Re:C and C++ Prioritize Performance over Correctness by jacquesm on Friday August 18, 2023 @06:09PM (#37182798)
My one experience with FORTRAN was when working for a big dutch architect who made spaceframes, I built their cad system and a colleague built the finite element analysis module based on an existing library. We agreed on a common format and happily exchanged files with coordinates, wall thicknesses and information about the materials the structure was made out of and forces in one direction and a file with displacements in the other. It worked like a charm (combined C and FORTRAN). I thought it was quite readable, it felt a bit archaic but on the whole not more archaic than COBOL which I had also worked with.

The reason that library existed in FORTRAN was that it had a native 'vector' type and allowed for decent optimization on the proper hardware (ie: multiply and accumulate) which we did not have. But the library had been validated and was approved for civil engineering purposes, porting it over would have been a ton of work and would not have served any purpose, besides it would have required recertification.

As for VAXen: A VAX 11/780 is a 32 bit minicomputer, something the size of a large fridge (though later there were also smaller ones and today you could probably stick one on a business card). It had a - for the time - a relatively large amount of memory, and was a timesharing system, in other words, multiple people used the same computer via terminals.

They weren't special per se other than that a whole raft of programmers from those days cut their teeth on them either because they came across them in universities or because they worked with them professionally. They were 'affordable' in the sense that you did not need to be a multinational or a bank in order to buy one, think a few hundred thousand $ (which was still quite a fortune back then).

I had occasional access to one through the uni account of a friend, but never did any serious work with them. The first powerful machine I got my hands on was the Atari ST, which had a 68K chip in it and allowed the connection of a hard drive. Together those two things really boosted my capabilities, suddenly I had access to a whole 512K of RAM (later 1M) and some serious compute. Compared to a time shared VAX it was much better, though the VAX had more raw power.

Concurrent to that I programmed on mainframes for a bank for about a year or so, as well as on the BBC Micro computer (6502 based) and the Dragon 32 (a UK based Color Computer clone).

Fun times. Computing back then was both more and less accessible than it is today. More because the machines were so much simpler, less because you didn't have the internet at your disposal to look stuff up.

Re:C and C++ Prioritize Performance over Correctness by mcguire on Friday August 18, 2023 @07:02PM (#37183242)
There was a freely available FORTRAN on the Fred Fish Amiga disks in the late 80s. It came with a weird license---free for everything, but it couldn't be used for military or military-related things.

The 386 was hampered by backwards compatibility with the weird memory architecture for the 286 and 8086, IIRC. 68Ks were just soooo much easier.

Re:C and C++ Prioritize Performance over Correctness by jacquesm on Friday August 18, 2023 @07:07PM (#37183298)
Oh cool, I never knew that. 386 flat mode was easy enough, but only djgpp unlocked that properly, everything else was a hodgepodge of the weirdest memory models.

I remember making a bootloader for my own OS using TurboC that somehow had to fish four files from a minix based filesystem and dump them in memory at certain addresses and then switch to flat mode and start executing the kernel which would then initialize the system properly. That was some really weird mixed mode voodoo to switch back and forth between protected mode and real mode to be able to both use BIOS calls to fetch blocks from disk and to be able to park the data in the right spots in contiguous memory.

Very tricky stuff to get right, it took me forever before I had the first indication that something was executing after the inevitable hail Mary jump to the first instruction in the loaded kernel. But I got it to work. I actually had a guitar footpedal hooked to the reset button because it took me too many dives under the desk to recover from a crash. That was a very slow development cycle without any chance of debugging. At some point I had 8 leds hooked up to the printer port to use some 'out' opcodes to tell me where I had gotten to in the code. Poor mans emulator :)

Re:C and C++ Prioritize Performance over Correctness by mcguire on Friday August 18, 2023 @07:08PM (#37183303)
FORTRAN didn't officially grow a program stack until FORTRAN 90 (?), although I'm told some of the earlier FORTRAN 77-era compilers supported it.

I remember meeting people who could not wrap their heads around the idea that function parameters weren't all passed by reference. The idea of recursion would have caused them to detonate.

Re:C and C++ Prioritize Performance over Correctness by jacquesm on Friday August 18, 2023 @05:02PM (#37182061)
For practical purposes - involving real world constraints in memory size, cpu power and storage - C was the tool of choice, it ran on just about everything, allowed you to get half decent performance without having to resort to assembler and was extremely memory efficient compared to other languages. Compilers were affordable (Turbo C for instance, but also many others such as Mark Williams C) even for young people like me (young then...) and there was enough documentation to get you off the ground. Other languages may have been available (besides the ubiquitous BASIC, and some niche languages such as FORTH) but they were as a rule either academic, highly proprietary and very, very expensive.

So that left C (before cfront was introduced). And we ran with it, everybody around was using C, there wasn't the enormous choice in languages that you have today, you either programmed in C or you were working in assembler for serious and time-critical work.

Re:C and C++ Prioritize Performance over Correctness by pjmlp on Saturday August 19, 2023 @04:13AM (#37186651)
Modula-2 and Pascal dialects compilers were also quite affordable, many of which being sold by companies that were selling the same C compilers, there were even product packages to get all languages in one go.

Easily proven by looking into computing magazine archives.

So lets not distorce history.

Re:C and C++ Prioritize Performance over Correctness by jacquesm on Saturday August 19, 2023 @05:36AM (#37187056)
I'm not 'distorting history', I'm just relating what was practical. Yes, there was Modula-2 and yes there was Pascal. But both felt extremely academic and restricted. Pascal still lives on today in the form of Delphi, which has to be a record for being in continuous use as a complete environment. I even paid for both Pascal and Modula-2 on the BBC Micro but performance was just horrible compared to the BASIC that came with that machine in spite of being compiled, compilation took a long time, even for simple programs. Wirth's books were enlightening though and I took a lot of lessons and algorithms from them and ported them to C (some of those I'm still using today!).
Re:C and C++ Prioritize Performance over Correctness by pjmlp on Saturday August 19, 2023 @06:00AM (#37187170)
Yes you definitly are, given how Modula-2 and Pascal were widely adopted across the European continent, specially in demoscene circles in the PC and Amiga ecosystems.

As if the BBC Micro was an example of the industry adoption at large during those days.

Any Byte, Computer Shopper, DDJ, The C Users Journal (later The C/C++ Users Journal), Crash, Amiga Format, Input, PC Techniques, You Computer, Your Sinclair,... from 1980 - 1995 thereabouts, shows a different picture in article contents and ad sections, in terms of language adoption and available set of compilers being sold.

Re:C and C++ Prioritize Performance over Correctness by jacquesm on Saturday August 19, 2023 @06:43AM (#37187400)
I'm not sure why this upsets you as much as it does. For me the 'common' languages in use were various flavors of BASIC, COBOL, various flavors of Assembly and C in that order and those were doing a lot of work compared to the rest of the large number of languages that was technically available. I personally liked and worked with many more but they weren't exactly in mainstream use even though you could get them if you wanted to.

It's a bit like me saying that today Erlang is widely adopted. Yes it is, in some circles and I absolutely love it. But even though it has some adoption the big heavy lifters today are Python, C++, C and Java. Maybe C# on account of MS and probably Javascript should rate a mention. That doesn't mean that the other 2500 or so computer programming languages do not exist or do not have relevance. But it is a realistic reflection of market share. At the computer store where I occasionally worked you could see this reflected in the requests for boxed copies of compilers and interpreters for various languages.

FoxPRO + Delphi became a very powerful combination for SME administrative systems (and before that DBIII) and once Apple launched Objective-C that got some significant market share on their platform too. But any kind of commercially developed software outside of those niches was likely to be built on the list above.

I've taken a great interest in various programming languages and learned a lot of them to the point that I could write code in them to compare them, so I'm well aware all of these (and many more!) existed. The machines I worked with were: Dragon32, BBC Micro, Acorn Atom, Apple II, C64 (though, mostly from a hardware point of view, to fix them), Atari ST (lots of work on that one), IBM PC, some mainframes (notably: IBM 4381, Sperry 1100/90) and probably others that I don't remember right now.

Some of those only had proprietary languages and compilers on them, and on some things were more free. If there was a language on any of those systems that made it large enough to rate an article in the magazines you mentioned I probably played with it. But across all of the people that I worked with at the time I've met exactly one person the programmed in Pascal and they abandoned the project because it was dog slow (it got ported to assembly...) and Modula-2 or Oberon I've never come across in the wild other than with my own experiments.

BASIC, COBOL, Assembly and C were the languages that I recall being in mainstream use. That does not invalidate your experience, it may simply not match mine.

Re:C and C++ Prioritize Performance over Correctness by pjmlp on Saturday August 19, 2023 @10:20AM (#37189057)
Yeah, my experience was indeed something else, regarding the software industry in Iberian Peninsula, Germany, France and Switzerland from 1970's until modern times.

What triggers me is the usual kind of message that C wiped everything away, being the first of its kind, when on other realities, it only started to matter when UNIX tooling became part of the picture.

On my bubble C became a thing, when Windows 3.0 went mainstream.

Coding in C on MS-DOS was mostly preparing exercises for Xenix programming classes, a single tower that students had to take turns on, so we need to prepare everything in advance on Turbo C 2.0.

On Amiga it was mostly Assembly and AMOS, on the demoscene community I was part of.

Re:C and C++ Prioritize Performance over Correctness by jacquesm on Saturday August 19, 2023 @02:27PM (#37191633)
In what year did you start programming professionally and in what languages was that done and on what kind of machines?
Re:C and C++ Prioritize Performance over Correctness by pjmlp on Sunday August 20, 2023 @02:47AM (#37196813)
Ah, trying a trick question?

In 1992, using a mix of Turbo Pascal, DBase III+ and Clipper on MS-DOS computers, and Novell Netware.

Re:C and C++ Prioritize Performance over Correctness by jacquesm on Sunday August 20, 2023 @07:23AM (#37198101)
> Ah, trying a trick question?

No, I was just curious. Why would you even think I was trying to trick you? And into what?

You normally make a ton of sense but in this thread I can't follow you and I sense a ton of emotion and projection that are entirely out of character for you.

Re:C and C++ Prioritize Performance over Correctness by mcguire on Saturday August 19, 2023 @04:17PM (#37192728)
One of my favorite quotes comes from DDJ in the late 80s, from a letter to the editor. Something like:

"Object oriented programming is just functions with persistent state and multiple entry points, and we all learned how bad that was in the 70s."

Re:C and C++ Prioritize Performance over Correctness by notacoward on Friday August 18, 2023 @05:59PM (#37182722)
The fact that those things existed does not refute the GP's point. Many companies well into the 80s at least had programmers and codebases that had to be weaned away from assembly, despite the fact that higher-level alternatives had existed for a while. That's just empirical fact, regardless of the reasons. I myself started programming in 68K assembly on the original Mac because I couldn't afford a compiler and interpreted languages (there were at least Lisp and Forth) couldn't be used to write things like desk accessories. Remember, gcc wasn't always something one could just assume for any given platform. The original statement is correct; yours is not, because of limited perspective.
Re:C and C++ Prioritize Performance over Correctness by mcguire on Friday August 18, 2023 @06:57PM (#37183198)
How many Lisp Machines did Texas Instruments sell? (I mean outside of that one lab at UT Austin.) :-)

I'm talking about applications developers who came out of the small mainframe/minicomputer world of the 70s and into the workstation/microcomputer world of the 80s. They started with assembly, and prying them off of it was as hard as convincing engineers to use FORTRAN. Convincing those application developers to use a garbage collected language, Java, was hard in the 90s.