And one other comment. I've seen all the nay sayers saying this is
undefined and that will trip you up, C is full of land mines, etc, etc.
I ran a company that developed a product that was orders of magnitude more
complex than the v7 kernel (low bar but still) all in C and we had *NONE*
of those supposed problems. We were careful to use stuff that worked,
I'm "famous" in that company as the guy was viewed as "that was
invented
after 1980 so Larry won't let us use it". Not true, we used mmap and used
POSIX signals, but mostly true. If you stick to the basics, C just works.
And is portable, we supported every Unix (even SCO), MacOS, Windows, and
all the Linux variants from ARM to IBM mainframes. It was fine. We did
ship our own libc, NetBSD's because it had fpush() and we used that to
do compression and CRC checking and it got around other crappy libc
implementations.
If you want to go out of your way to find places where it doesn't, umm,
go you I guess, but why go there? I have an existence proof that you
can use C sensibly and it is fine. The company made it to 18 years
before the open source guys shut us down, not a bad run.
All that said, I get it, you want guard rails. You are not wrong, the
caliber of programmers these days are nowhere near Bell Labs or Sun or
my guys. I'm not sure what I'd do if I were starting over, I'd lean
towards C but would take a hard look at Rust.
On Sun, Sep 29, 2024 at 05:36:30PM -0700, Larry McVoy wrote:
It doesn't have to be that way, C could be
evolved, I built a very C
like language (to the point that one of my engineers, who hated the
new language on principle, fixed a bug in some diffs that flew by,
he thought he was fixing a bug in C). No pointers, reference counted
garbage collection, pass by value or reference, switch values could be
anything, values, variables, regular expressions, etc.
If I had infinite energy and money, I'd fund a gcc dialect of that C.
Alas, I don't. But C is very fixable.
On Mon, Sep 30, 2024 at 09:56:47AM +1000, Rob Pike wrote:
I'm saying the exact opposite: they are
unavoidably unsafe.
-rob
On Mon, Sep 30, 2024 at 8:21???AM Rich Salz <rich.salz(a)gmail.com> wrote:
> C and C++ have become non-portable and dangerously insecure, as well as
>> often very surprising to the point that the US government arguing against
>> using them.
>>
>
> I thought their main arguments were to use memory-safe languages. Are you
> saying the C language can be as safe s go, rust, etc., by language design?
> (I don't think you are, but the sentence I quoted kinda implies that, at
> least to me.)
>
--
---
Larry McVoy Retired to fishing
http://www.mcvoy.com/lm/boat
--
---
Larry McVoy Retired to fishing
http://www.mcvoy.com/lm/boat