Live data from Hacker News

Ask HN: Learn C in 2023?

news.ycombinator.com

121–130 of 220 posts

Re: Ask HN: Learn C in 2023?

#121

Earlier quoted context omitted.

> or how to mitigate some of the security downfalls. I think I'd go further, there are places where it advocates downright unsafe practices. Eg. It's been a long time, but I thought I remember it introducing gets() unironically, without any caveat. For those that do not know, there is no safe use of that interface possible.

If you're just beginning with C, it doesn't matter. If anything, it's better to be exposed to these unsafe practices and make mistakes with them in the very safe environment of your own home, where absolutely no one cares what you're doing. K&R C is an excellent learning resource primarily because it's extremely strong pedagogically. Read K&R and then move onto something else later when you're done with it. If you ev…

I kinda disagree. global hidden state under APIs is a really awful idea to put in someone's head.

I think it also presents the notion to neophytes that there is magic under there

Re: Ask HN: Learn C in 2023?

#122
post #17

I like firearms as an analogy here. Rust is like a modern rifle, unloaded, with six safeties and three locked triggers in a gun safe. The ammunition will harmlessly self-destruct if you don’t focus properly before firing. C is sort of like Rust except the rifle is on the couch, loaded, one in the chamber, all the safeties are off, the numerous open triggers are held by RNGs, and the business end is pointed right at y…

Ha.

Confession time: I came to this thread to Ctrl-F for "Rust" to find the Rust-C fisticuffs. And this answer is like what I would expect if I said "ChatGPT, write me a reddit-style Rust defense that would rustle some jimmies."

I'm about equally capable at both Rust and C - I could pass a 1st year undergrad CS course using either, but I'm no better than that.

I know C has its place - its marketshare of embedded devices and gamedev is huuuge - and Rust... may eventually reach a similar place of importance, but isn't there yet.

I also know the very best C and Rust devs are pretty much geniuses - Ph.D. level understanding of math, that kind of thing - and would squash me in any type of fair competition.

Maybe in the year 2050, an attitude of condescending acceptance towards C might be appropriate. And also... maybe not, because C might not slip. Who knows?

And really, beyond this pretty crude but accurate-ish description, I think we're getting into unnecessary hair-splitting, among people who don't work with either and wouldn't understand the tradeoffs anyway.

Re: Ask HN: Learn C in 2023?

#123
post #83

C was the first language I learned after messing around with various flavors of BASIC way back in the day. I learned C using Turbo C for DOS and a big book, which is probably an 'obsolete' way of learning in 2023. Haven't used it professionally in over a decade now, I'd be interested in learning Rust, but don't really have a need to do anything low(ish) level these days.

Same here! I started with AmigaBASIC and 68000 assembly and learned C when my family switched over to Intel/DOS machines.

Addressing modes back then!

Re: Ask HN: Learn C in 2023?

#124

Earlier quoted context omitted.

There is no meaningful sense in which either Rust or Go’s reference compilers is “proprietary.” If you’re trying to say that there is no ISO standard for the two, that’s an entirely different problem (and one shared by the overwhelming majority of programming languages).

> There is no meaningful sense in which either Rust or Go’s reference compilers is “proprietary.” Nobody is talking about the compilers. This, right here — the fact that you are conflating a language and one implementation — is the whole point and is indicative of the tight control the respective organizations keep over their languages. The direction of the languages is entirely up to their private owners, and that e…

> The direction of the languages is entirely up to their private owners, and that exclusivity is enforced via intellectual property law.

Can't you just fork the language, or, just re Rust, participate in the RFC process? Do we need more bureaucracy?

Re: Ask HN: Learn C in 2023?

#125
post #83

C was the first language I learned after messing around with various flavors of BASIC way back in the day. I learned C using Turbo C for DOS and a big book, which is probably an 'obsolete' way of learning in 2023. Haven't used it professionally in over a decade now, I'd be interested in learning Rust, but don't really have a need to do anything low(ish) level these days.

Same here! I started with AmigaBASIC and 68000 assembly and learned C when my family switched over to Intel/DOS machines. Addressing modes back then!

Yep. Started with Apple BASIC on an Apple ][e, then Amos on the Amiga, then C on MSDOS :).

Re: Ask HN: Learn C in 2023?

#126

Earlier quoted context omitted.

If you're just beginning with C, it doesn't matter. If anything, it's better to be exposed to these unsafe practices and make mistakes with them in the very safe environment of your own home, where absolutely no one cares what you're doing. K&R C is an excellent learning resource primarily because it's extremely strong pedagogically. Read K&R and then move onto something else later when you're done with it. If you ev…

I kinda disagree. global hidden state under APIs is a really awful idea to put in someone's head. I think it also presents the notion to neophytes that there is magic under there

Unfortunately, global hidden state is an unavoidable fact of programming. I don't see how one could be very good at programming if they were kept blissfully ignorant of it. Sometimes there is magic under there, and you just have to do your best to empirically figure out how that magic works.

Re: Ask HN: Learn C in 2023?

#127

Programming in C can turn you into a very disciplined programmer for the simple fact that you will need to track when you request memory and when you need to free it. Essentially you will become the garbage collector. I would recommend you to the read classic "The C Programming Language" (Kernighan & Ritchie) and "Expert C Programming Deep C Secrets" (Van Der Linden) which will get you far enough to write useful prog…

I don't recommend learning how to use Autotools unless you need to work on a project that uses it (and even then, try to avoid it). Highly recommend learning CMake or Meson instead. If you're just getting started, there's no need to tie yourself into knots learning "how to set up a project the right way". It's a waste of time. Your time would initially be better spent just calling the C compiler directly. This will h…

You probably don't need autotools as a beginner but if you intend to study those it makes no point starting with cmake. This is more of a C++ crowd thing with tiny mindshare among C programmers.

Re: Ask HN: Learn C in 2023?

#128

Earlier quoted context omitted.

> There is no meaningful sense in which either Rust or Go’s reference compilers is “proprietary.” Nobody is talking about the compilers. This, right here — the fact that you are conflating a language and one implementation — is the whole point and is indicative of the tight control the respective organizations keep over their languages. The direction of the languages is entirely up to their private owners, and that e…

This is not a definition of "proprietary" used anywhere in the open source community. Private direction (which Rust notably does not have) does not somehow erase the fact that both are permissively licensed and have open codebases that you can use and contribute to to your heart's content. I don't even know what you're referring to with IP law. The projects' names and logos?

> both are permissively licensed

No, the code of the implementation is permissively licensed.

Do I really have to explain, on HN of all places, the importance of distinguishing between implementation and interface?

Re: Ask HN: Learn C in 2023?

#129
post #50

Earlier quoted context omitted.

What is your opinion on K&R?

It's much too awkward IMHO, C99 and onward almost feels like a whole new language (mainly because of struct literal and designated init support).

Not being forced to declare symbols in the beginning of the scope is the real game changer I say. K&R or C89 without e.g. GNU extensions is really annoying to use.

Re: Ask HN: Learn C in 2023?

#130

Programming in C can turn you into a very disciplined programmer for the simple fact that you will need to track when you request memory and when you need to free it. Essentially you will become the garbage collector. I would recommend you to the read classic "The C Programming Language" (Kernighan & Ritchie) and "Expert C Programming Deep C Secrets" (Van Der Linden) which will get you far enough to write useful prog…

I don't recommend learning how to use Autotools unless you need to work on a project that uses it (and even then, try to avoid it). Highly recommend learning CMake or Meson instead. If you're just getting started, there's no need to tie yourself into knots learning "how to set up a project the right way". It's a waste of time. Your time would initially be better spent just calling the C compiler directly. This will h…

I disagree, I find autoconf and automake very pleasant in operation. Mainly due to the OOTB support for things like bindir, libdir, and so on, all properly documented via /path/to/configure --help.
Post reply on HN