On 06/09/2018 10:16 PM, Leslie Turriff wrote:
I'm using the source code for the open-source
Thompson-Davis Editor
<http://adoxa.altervista.org/tde/>, "a simple, public domain, multi-file,
multi-window binary and text file editor written for IBM PCs and close
compatibles running DOS, Win32 (console) or Linux" to learn C and curses
programming.
You may have noticed its coincidental acronym :-) and yes, it stores it's
configuration information in $TDEHOME. TDE is small but non-trivial, and I
think it will be a good resource for someone like me, who is attempting to
get a grip on programming in the *nix environment; it's not so big as to be
overwhelming, yet not as useless as HelloWorld.c.
Thoughts?
Leslie
Leslie,
If you truly want to learn C, and you are looking for editors, you have two
basic classes of editors you can use (both more than capable). Your choices
are either traditional text-console/curses based (e.g. vim, emacs and what
sounds like Thompson-Davis is), or you have your ui-toolkit based editors like
kate, kwrite, geany (
https://github.com/geany/geany) or codeblocks
(
http://www.codeblocks.org/downloads).
Of the two, I prefer the ui-toolkit based editors, but I'm at home with vim
as well. In the ui category -- you really cannot do better than kate/kwrite
(and if you aren't smart enough to use TDE, then a geany or codeblocks work well).
For the text/curses based class, it's a preferences thing. vim, or emacs are
both incredibly capable, though I find emacs a bit heavier than vim.
Learning C is one of the best choices you can make. Nothing else (aside from
assembly) provides you the complete control over hardware as C does. However,
working at the hardware level comes with great responsibility. You are
responsible for memory management. One-byte too few and you walk off into the
realm of Undefined Behavior. Leaning C, you learn to program and will be a
better programmer as a result, regardless of which language you ultimately end
up writing in.
The best advice anyone can give you in learning C is simply to slow-down. C
is an exact language. Understand every declaration, the proper use of each
library function and for God sake validate the return of every allocation and
every I/O call. You don't digest the whole library at once. When you use a
library function, open the man page -- read it -- pay careful attention to all
parameter type, return types and the RETURN section of the page.
(pay particular attention to the man page for the scanf family -- which
provides no end of pitfall for the new C programmer who fails to learn the
distinction between a *matching* and *input* failure and fails to understand
that when either occur, no further characters are extracted from the input
stream and are left unread -- just waiting to bite you on your next call)
When you are learning, forget an IDE, build your code on the command line so
you actually learn what the compiler option are and how to correctly use them
-- then you can properly use an IDE. Until you understand how to compile and
link your code -- there is no way you can tell an IDE how to do it.
*Always* compile with *warnings enabled* and do not accept code until it
compile cleanly, without warning. For gcc/clang that means adding -Wall
-Wextra -pedantic (and I would add -Wshadow) to your command line. (clang also
provides -Weverything). If you hop on a windoze box, the for VS (cl.exe) use
/W3 (/Wall provides a great deal of non-code specific warnings that are a bit
much).
Finally, go get an account on
StackOverflow.com -- seriously. If you have a
C question -- it has probably already be answered 50 times over, and the
answer peer-reviewed. (the same applies for just about any language, it is a
fantastic site) Before you post a question you are expected to have searched
for a similar one and taken the
http://stackoverflow.com/tour, visited
http://stackoverflow.com/questions/how-to-ask and when posting always provide
a
http://stackoverflow.com/help/mcve (a minimal, complete and verifiable
example -- meaning something those there can compile to verify your code
behavior and help debug)
Learning C isn't something your do in a day, or a week, or month, or year --
it is a journey -- enjoy the ride.
--
David C. Rankin, J.D.,P.E.