Hendrik Boom said on Tue, 1 Oct 2024 10:41:18 -0400
>C is harder to use than Ada; it is closer to assembly language, and
>has many of the pitfalls of assembler.
I think C is very easy to learn because it's a minimalist language with
very few commands and built-in data structures and objects (actually no
objects). I think it's very easy to learn if and only if:
* You compile with -Wall and fix every single warning.
* You reject cutesy K&Risms and make loops look like loops, ifs look
like ifs, be very careful with switch-case statements, don't use that
silly question mark operator even though it saves a couple lines of
code more than an if, and don't use ifs and ors as branch logic. With
today's optimizing compilers, you don't need to do all those K&R
shortcuts. Go for readability.
* Initialize every variable upon declaration, especially pointers,
which if nothing else should be initialized to NULL.
* Every time, all the time, guard against running outside of array
boundaries.
* If declarations get too hairy, use typedefs. If they're really hairy,
use nested typedefs. Comment the hairy stuff.
* Like any other language, make your variable names and function names
tell what it is or what it does.
* Be careful.
If the preceding are observed, the only difficult thing I've found in C
are pointers to functions. But those are so powerful they're a
wonderful thing to learn.
I have no idea how easy or hard Ada is to learn.
SteveT
Steve Litt
http://444domains.com