home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!news.claremont.edu!lexcel!mtinews!mti!adrian
- From: adrian@mti.mti.com (Adrian McCarthy)
- Newsgroups: comp.lang.c
- Subject: Re: Most difficult part of learning C?
- Message-ID: <706@mtinews.mti.com>
- Date: 28 Aug 92 17:08:10 GMT
- References: <9208251159.AA04122@ult4>
- Sender: news@mtinews.mti.com
- Organization: Micro Technology, Inc., Anaheim, CA
- Lines: 30
- Nntp-Posting-Host: mti
-
- I think one of the things the successful C programmers often *never* get
- is learning the distinction between what is part of the C language and
- what is part of their environment.
-
- I know several people who have programmed in C in the UNIX (mostly Sun)
- environment for many years who *never* realized that:
-
- o creat(), open(), close(), fork(), getopt(), etc., are part of the
- UNIX libraries and not an inherent part of C.
- o expressions like a[i++] = i may evaluate differently on different
- compilers. Many compilers and lints won't warn you when you use
- something like this.
- o exit codes are interpretted by the host OS (if there is one), so
- exit(1) isn't always the right way to signal an error.
-
- Unless your learning experience includes an instructor looking over your
- shoulder and reminding you of these things, it's very easy to confuse parts
- of the environment with the language. Some books do a good job of emphasizing
- these distinctions, others just mention it in passing. As a result, a
- successful C programmer who has experience with a single environment can
- find life very difficult when they are transplanted or must work simultaneously
- in two environments.
-
- These problems (especially the first) can happen with most languages, of
- course, but it seems to happen more with C programmers. Perhaps that's
- because so many C packages offer a library of UNIX library emulation routines,
- thus delaying the painful gotcha that happens when you finally realize the
- difference between a language run-time library features and a host OS feature.
-
- Aid. (adrian@lexcel.com)
-