Hacker News new | past | comments | ask | show | jobs | submit | more kahlonel's comments login

C++ has all the problems that come with C plus all of its own problems. Also, OOP is pointless.


C++ != OOP, while C++ cannot fix flaws inherited from C, at least it can provide types with bounds checking, and data types with type driven invariants, something that C will never provide.


C, GDB, an mcu dev kit, a Jlink probe, and an oscilloscope :)


Yeah it’s not like the browser you are using, the OS you have installed, or even the firmware of the keyboard you’re typing this on is written in C.


> At this time, Rust is the only viable alternative to C and C++ in these domains.

No, it’s not. See Ada/Spark.


Corrected that line. Thanks!

Updated line: > At this time, Rust is one of few viable alternatives to C and C++ in these domains. (Other alternatives include ADA, Spark, and Zig)


Also there is Circuitpython and MicroPython. Probably less ideal for production. But capable enough for those less familiar with programming.


I need to think on this one - I don't think they're suitable for embedded beyond the scope of learning. Eg a non-starter for anything battery powered, or with minimal latency requirements, which are both common in embedded. More subjectively, they strike me as something designed for people who approach problems with a mindset of "I'm a Python programmer - how do I do this without learning a new language?".

I'm writing Python code now to prototype DSP algorithms and generate coefficients for embedded, but I wouldn't run Python on the MCU.


No, we can’t. Because C is a necessary evil. If you stop teaching people to program in C, who is going to maintain virtually every software this world is running on?


Presumably the same way find all of the people who maintain all of the critical software written in Fortran or COBOL or Ada or other languages that aren't really taught in schools anymore.

If a new hire is minimally competent at programming, I can bring them up to speed in whatever language it is we are using. Hell, even when people have notionally been taught a language in school, there's a decent chance I would still have to train them in that language as a new hire, because what they learned in school may be insufficient to cover the complexities that get involved in practice.

And to OP's point: C itself is a pretty poor language at covering what it actually covers. It has some missing features that just seem random (e.g., there are no 8- or 16-bit arithmetic operators in C). It has gratuitous undefined behavior (signed integer overflow and strict aliasing). As a language design, it's atrociously outdated (#include is a very poor substitute for modules, and generic programming might as well not exist in C). There are questionable features--null-terminated strings don't look like such a good idea in retrospect. Even if you want to avail yourself of its strengths--access to low-level hardware features--C's gratuitous undefined behavior (particularly strict aliasing) undercut it there, and languages like Rust and Zig give you the same power with none of C's warts.


> C itself is a pretty poor language at covering what it actually covers.

C's job is to be the first thing ported to a new architecture, allow you to bootstrap a system, and build on top of it (last 2 steps optional if you're working on some sort of embedded system).

And, frankly, it's reasonably good at that. Writing a simple C compiler is trivial compared to something like rust.


You don't have to write a Rust compiler. You have to write an LLVM codegen backend. Is it that hard to do?


Depends on how exotic of an architecture we're talking about.


It’s a well known way of getting your post to HN frontpage.


Exactly. Just like “terrorism” is used as an excuse to take control of oil fields.


Just like the drug war is used as an excuse to empower fascists in government, strip citizens of their constitutional rights, and disrupt leftist and minority communities.


> The underlying thing to appreciate here is that the goal is to make these kinds of mistakes not only much harder but impossible

Hate to break it to you, but it is not "impossible" to have CVEs in Rust [1].

1. https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=rust


Of course, but I would argue those aren't the same "kind of mistake".


I think a simple “const” would have also done the trick. Sometimes -O3 is clever enough to figure out that the value is never written, so it makes it an asm constant.


It is mostly about the fact that if the variable is not static, then it's non-local to the translation unit and can be modified from everywhere else. So its value needs to be loaded and a plain and slow division is applied.

Having it local or const makes the compiler able to inline it and do a simple bitwise and with a constant.

So yes, make your variables static const by default (if you really need global).


const_cast and linkage make const weaker than static on a variable that doesn't change.


I, on the other hand, appreciate Safari not being an utter resource-hog and a battery drainer. I don't need all these shiny features. I'm ok with "dumbed down" static sites.


Exactly this. I've tried Chromium, I've tried Firefox. Safari is simply much faster.

From TFA:

> I'll add a banner asking the user to switch to a more modern browser, like Chrome or Firefox, if he's on a Mac.

I believe the phrase is "good luck with that". Is the author's site genuinely more compelling than the user's choice of browser?


Exactly. If the site doesn’t work in Safari, I don’t need it. If you are designing a site for my consumption, you damn well better be designing it to be usable on my devices. Especially my iOS and iPadOS devices which account for about 70% of my tech use.


How odd to demand anything of a free content producer, no?


There was a free concert in a park of my city recently. I wouldn’t mind hearing it, but traffic and parking was too much of a pain in the ass so I stayed away.

How odd that I would let things that irritate me get in the way of hearing a free concert.


I'm not sure I understand you correctly, but I think it would be a more apt comparison to complain about the songs performed at the free concert rather than all the externalities of it. If that's your complaint, then I stand by my observation: how odd...


Safari on osx makes requests to URLs you type in but before you actually hit enter.

No doubt this makes it feel faster


I've got that turned off. Still much, much faster than anything Chromium-based.


Wait until you try the new Safari Tech Preview. It seems significantly faster. So far, I don't hate the new UI, but I need to add more tabs.


Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: