Live data from Hacker News

Getting started with C

not.cafe

101–106 of 106 posts

Re: Getting started with C

#101
post #4

The article uses nano throughout. Is nano a popularly used editor? I have not seen anyone around using nano. I see vim, atom, sublime, vs code but never nano. Just curious if nano is popular. If nano is popular what are its pros and cons?

Nano is the easiest-to-use terminal-based editor that you're likely to find on a Unix system by default. All the important key commands are listed at the bottom of the screen and everything! It's a great editor to recommend in beginner tutorials since it requires very little setup or learning to use, but if you're already happy with a different one there's probably no reason to switch.

I was kind of surprised that they had installation steps for it, to be honest–macOS certainly ships with it.

Re: Getting started with C

#102
post #34

One of my biggest bugbears on C / C++ programming is return 0; I wish people would #include / and use EXIT_SUCCESS / EXIT_FAILURE just to make the code more obvious for the beginner on what the intent is. :-) To quote the "zen of python" "Explicit is better than implicit" we know what "SUCCESS" or "FAILURE" is! And we can use enums for other exit values.

Returning either EXIT_SUCCESS or 0 is a valid way to terminate the program with an implementation-defined exit code appropriate for your platform.

Re: Getting started with C

#103

Earlier quoted context omitted.

If an absolute beginner were to use K&R as a start they'd be learning C from 35 or so years ago. It's well written, but not helpful as a reference. Even something as simple as how a function is organized has changed. C Programming: a Modern Approach teaches C89 and C99, pointing out the differences in features when appropriate. Having used it myself this year, I found it much more helpful than K&R

If you start with the second edition (C89 / "ANSI C"), you'll discover that C has barely changed.

Yes, that's true. C Programming is largely a C89 book with small segments about C99.

Re: Getting started with C

#105
post #78

The absolute beginner technical guide may be the most difficult kind of writing there is. You have to know what's already in the head of the absolute beginner. If it's garbage, you need to set that straight before anything else can happen. You also have to know what's not in the head of an absolute beginner. Then you need to fill the gaps with background material. Not too much or your audience will tune out. Not too…

Yea, if I were writing something with the bold title "Absolute Beginner's Guide To..." I'd want to test it on my 8-year old who only knows how to launch the web browser and Minecraft. If she can use it successfully to cobble together a working Hello World program, then it's indeed an absolute beginner's guide.

"Absolute beginners" does not mean there is no pre-requisite knowledge necessary, just no pre-requesite knowledge of C. If I took an "absolute beginners guide to calculus" it would be assumed or directly stated that the reader is expected to have some basic numeracy and literacy for the book.

Re: Getting started with C

#106
post #18
post #11

Earlier quoted context omitted.

It kind of depends on what you need out of C. The only real reasons left to use C in the wild are: * Legacy code * Embedded (including drivers, bare metal etc.) * Portability, FFI, etc. Performance used to be another major reason, but in $CURRENT_YEAR, if that's your goal, C++ and Rust are just as performant and there's very little reason not to opt into them. The other major reason to learn C is that it's a great "h…

I would still suggest that people learn C before attempting C++; while someone with C# or Java experience could probably do well in a "modern C++" codebase, as soon as they go off-piste into memory allocation and pointers they're in for surprises. (Is there anyone who learns Rust who isn't already a proficient but frustrated C++ programmer?)

I learn Rust because I need a statically typed non-jvm alternative for backend and for me Go is lackluster in its expressiveness after coming from Scala.
Post reply on HN