Live data from Hacker News

Modern C [pdf]

icube-icps.unistra.fr

91–100 of 396 posts

Re: Modern C [pdf]

#91
post #67

What alternatives there are for C/C++ if you want to write library that you can call from Python, R, Matlab, Java, Rust, Lua, node.js ... and have good performance? Old ones like Ada and Fortran of course. There are newcomers like Rust and Go. Are their C api's mature and portable?

This isn't really something that Go is meant to do, but it is possible with a little bit of hacking.

https://blog.heroku.com/see_python_see_python_go_go_python_g...

Re: Modern C [pdf]

#92

Earlier quoted context omitted.

Yeah, again and again. it's like blaming a hammer for the potential of breaking your finger when you use it, and proposing the use of a spoon, instead.

If the handle of the hammer you're holding was a chainsaw that randomly turns on and off. And also sometimes explodes killing your entire family and pet dog. Don't blame the explodey-chainsaw-hammer, it's just a tool . Okay an idiotically dangerous too that nobody in their right mind should use, but still just a tool.

C is utterly predictable. Maybe you're the exploding chainsaw in this metaphor.

Re: Modern C [pdf]

#93

Earlier quoted context omitted.

Yeah, again and again. it's like blaming a hammer for the potential of breaking your finger when you use it, and proposing the use of a spoon, instead.

While I am all about C/C++ (even if I hate it), it makes sense HN is probably something like 99% web and app developers (I would argue that all are the former, but my definition may be a bit old). In those cases, you actively don't want to ever use C and anyone who does is kind of an idiot. It is the logic by which "systems project" means "script to run on a server" for a lot of people around here. And that is fine.…

My university in the mid-90's already knew it was better to teach safe practices in C++ and Pascal dialects than keep teaching pure C.

We were supposed to be able to use C in the OS design classes from our C++ learnings.

Re: Modern C [pdf]

#94
post #65

Earlier quoted context omitted.

In a PDF no less. I for one do not miss C (or Objective-C for a long time) at all. I built my first commercial app in C starting in the mid 1985 (Mac). That's how much of an antique this language is.

And yet, the OS and the browser you used to type this comment was written in C or a C-derivative like C++.

Historical accident.

It could have been written in any other language that compiled to native code, if we had more options available.

Re: Modern C [pdf]

#95
post #58

Earlier quoted context omitted.

Also Rust doesn't support compiling to certain architectures like the Xtensa ISA used in the popular ESP8266 and ESP32 wi-fi chips.

Also, Rusts standard library is simply too big for many embedded systems. Last time I checked the compiler didn't support bare-metal and resource constrained builds without using crazy hacks. Although the situation may have improved since then.

I think it now amounts to adding a line to the file that tells it to not use the standard library. I've seen smaller projects that did it, and it was nothing like crazy hacks.

Re: Modern C [pdf]

#96
post #82
post #62

The author has also been involved in development of "musl", a modern C11 compliant standard library implementation: http://www.musl-libc.org https://gustedt.wordpress.com/2014/10/14/musl-1-1-5-with-ful...

complaint yeah I hear that often when talking about C11 :]

hah! fixed that for you.

Who would complain about something as wonderful as C11, outside it not being available for your compiler?

Re: Modern C [pdf]

#97

Earlier quoted context omitted.

Your criticism lacks constructivity. What do you propose we replace C with?

Depends on what you are writing. C isn't 100 percent replaceable right now but the more people bitch about it and support the alternatives, the better for the future.

Just curious, what are us C apologists supposed to be apologizing for:

- A lack of suitable replacement for C?

- C is too ubiquitous?

- C has been an integral part of most of the best software ever written?

Re: Modern C [pdf]

#98
post #94
post #65

Earlier quoted context omitted.

And yet, the OS and the browser you used to type this comment was written in C or a C-derivative like C++.

Historical accident. It could have been written in any other language that compiled to native code, if we had more options available.

Well, there are two types of people in this world

1. the type that do something

2. the type that claim they could do it better than the first group (this is by no means limited to programming, it is for example pretty common in politics)

So please show me an OS written in Go or Rust or Ruby or Python or Java that people can actually use for day-to-day tasks.

Re: Modern C [pdf]

#99
post #95
post #58

Earlier quoted context omitted.

Also, Rusts standard library is simply too big for many embedded systems. Last time I checked the compiler didn't support bare-metal and resource constrained builds without using crazy hacks. Although the situation may have improved since then.

I think it now amounts to adding a line to the file that tells it to not use the standard library. I've seen smaller projects that did it, and it was nothing like crazy hacks.

Fair enough, but it didn't used to be like that:

https://scialex.github.io/reenix.pdf

Re: Modern C [pdf]

#100
post #93

Earlier quoted context omitted.

While I am all about C/C++ (even if I hate it), it makes sense HN is probably something like 99% web and app developers (I would argue that all are the former, but my definition may be a bit old). In those cases, you actively don't want to ever use C and anyone who does is kind of an idiot. It is the logic by which "systems project" means "script to run on a server" for a lot of people around here. And that is fine.…

My university in the mid-90's already knew it was better to teach safe practices in C++ and Pascal dialects than keep teaching pure C. We were supposed to be able to use C in the OS design classes from our C++ learnings.

And I think that is the way to go. I am personally a fan of having more sciencey programs use matlab and more "pure" CS use python as the first languages. Save C/C++ for the lower level stuff (as in OSes and hardware interfaces and optimization). Although, I would argue that nothing beats C++ for teaching OOP and data structures

My problem is the almost dogmatic indoctrination that goes along with it. My cousin's Intro to CS class was taught by a professor who spent about a third of the time basically parroting Stallman (he actually would regularly bring up blog posts and articles on the screen and read them to the class...) and screaming about how everyone needs to use either Vim or Jetbrains tools. That isn't teaching. That is pushing an agenda. And it just makes for worse students and hell for those of us who still spend some time with the interns and new hires.

Always explore new and better tools. But understand why. Sous-vide is awesome and has the potential to make some of the best food you will ever eat. But it also understand that even a "worse" method can be much more efficient or effective.

Post reply on HN