Content-Length: 15098 | pFad | http://lwn.net/Articles/697203/

Weird [LWN.net]
|
|
Subscribe / Log in / New account

Weird

Weird

Posted Aug 14, 2016 4:31 UTC (Sun) by neilbrown (subscriber, #359)
In reply to: Weird by ncm
Parent article: Better types in C using sparse and smatch

> you can't learn Rust without learning new insights about the craft and nature of programming.

I have no doubt that you are correct, but these new insights do not come for free. Much as I love learning new things, I know that my capacity to do this is limited so I need to pace myself. Had I decided to write this project in Rust, I am quite confident that I would not have progressed a far as I have. Sometimes it makes sense to work with what you've got, even if that is "C".

Also, you are making an assumption that is worth highlighting. You are assuming that if some language is problematic, then the solution is to use a different language. I understand the thinking behind that assumption because programming languages have always effectively been isolated silos. But the "replace" approach doesn't always work so well: witness Python 3.

Maybe there is another way. A significant strength of the Linux kernel project is the incremental approach to improvements. Today's kernel is very different from Linux 1.0, but it is still "the same Linux". What if we could do that with a Language? The C standards process does to an extent, and "C11" is still "C", even though it is very different to K&R C. But there a limits to how much change can happen there.
It has always been possible for different projects to use different versions of C, thanks to the macro pre-processor. Having "list_for_each_entry" and similar is the kernel is a real boon.
Having pluggable semantic checks could be seen as just another step in that sort of approach. Why are you so sure that replacing C is a better approach than making C better.
I like the familiarity and universality of C, and the safety of Rust. Why should I not want both?

> It's hard to believe...

I would suggest that the evidence is against you there. My own observations tell me that people are, in general, quite capable of believing whatever they want to believe.
So I think you are really saying "I don't want to believe...". I assure you that I completely support your right to believe whatever you choose, but know that I will likely make different choices.


to post comments

Weird

Posted Aug 15, 2016 2:52 UTC (Mon) by ncm (guest, #165) [Link] (3 responses)

Making C better led directly to C++. There is no defensible reason for a programmer competent in C to choose it over C++ for a new program. All it takes to start is file names with a *.cc suffix, and the right compiler. If you don't like some feature in C++, you are not obliged to use it in your program. But the prospect of faster, more reliably correct programs written more quickly is a benefit you cannot rationally justify avoiding. Pottering about with hacks on C to help you catch problems that C++ already eliminated a decade ago is a tragic waste of your short time on Earth.

Learning Rust would certainly slow you down, for a while. Rust is mostly an opportunity for the next generation of serious programmers, and those who will teach them. But before you know it, the most interesting programs will be coded in Rust, and you will need to know it to read them.

Weird

Posted Aug 18, 2016 12:07 UTC (Thu) by tuna (guest, #44480) [Link]

If you want to make libraries that are usable from many different languages it is probably easier to use C than C++.

Weird

Posted Aug 18, 2016 16:26 UTC (Thu) by Wol (subscriber, #4433) [Link] (1 responses)

> There is no defensible reason for a programmer competent in C to choose it over C++ for a new program.

Why then, looking at lilypond and libreoffice C++ code, do I think "what the hell is going on here", yet when I looked at the (C) code for mdadm, I felt at home straight away?

Or, trying to write my pet project in C++, I'm left wondering how on earth I interact with the hardware to the extent that I actually know what is going on at the hardware level?

Cheers,
Wol

Weird

Posted Aug 18, 2016 16:37 UTC (Thu) by andresfreund (subscriber, #69562) [Link]

> Or, trying to write my pet project in C++, I'm left wondering how on earth I interact with the hardware to the extent that I actually know what is going on at the hardware level?

Huh? There's no difference between C and C++ on that end of things.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://lwn.net/Articles/697203/

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy