Mail Archives: djgpp/1996/05/17/10:15:55
From: mcoady AT generation DOT net (mcoady)
Date: 16 May 1996 01:53:45 GMT
Hi. I know very little about programming, having done some
BASIC and SP/K many years ago. I was considering trying to learn some C
and/or C++ by buying one of the many books available on the subject, but
I realized that this would be somewhat useless without having the
language available on my computer. I just learned about djgpp and I am
wondering.... well, is this what I need? My knowledge is sufficiently
basic that I'm not too clear on what a compiler is (for example). If I
download djgpp and struggle through the manual and pick up a book on
C/C++, will I be able to do some programming in these languages? Sorry
if my question isn't too clear, and thanks in advance for any
suggestions.
DJGPP is probably a good choice for learning C and C++ as it is less buggy,
more complete, and more standards compliant than commercial compilers and it is
also free!
Make certain that one of the books you get includes basic compilation
instructions for UNIX systems. Many books assume that you are using either MS
C/C++ or Borland C/C++ and only include instructions for using these compilers.
(Forget that MUCH more code is written on non-DOS boxes than on DOS systems,
even Intel writes its code for DOS on UNIX based cross compilers!) DJGPP is a
port of the GNU UNIX compiler and is VERY different from traditional MS-DOS
compilers. The docs are light on the basics of how-to so UNIX how-to
instruction from your books will definitely help.
Forget everything you learned about programming in BASIC and SP/K and you will
be fine. I've found that if you learn to "put on your 'X' head", in other
words think 'X'ish where X is the language in which you are trying to work,
learning new programming languages is not difficult. The biggest impediment to
learning a new programming language once you know another is the cultural
baggage one brings from the other language, the BASIC'isms or FORTRAN'isms for
example. When learning 'C' you must learn to use 'C'isms. I could give you
examples but....
A compiler is a program which translates a programming language source code
program into a machine code program, known as an object program, which can be
executed directly by the CPU. Contrast this with an interpreter, such as that
used by most versions of BASIC, which reads programming language source code
and executes a set of equivalent machine instructions on the fly. Code written
for interpreted languages; like basic, ksh, perl, java (although java actually
compiles to a pseudo-machine language [pcode] and that pcode is then
interpreted on the target computer), awk, etc; is more portable and can be
modified and tested more quickly than compiled code, but runs more slowly.
Compiled language programs must be compiled into a machine specific object
program and link-edited with library code into an executable for each machine
and operating system. The run-time penalty for an interpreted program versus a
compiled program in the same language can vary from 15% for a well implemented
pcode system running on a processor whose architecture closely matches the
non-existent p-machine to 100% or more for a purely interpreted language that
does not closely match most machine architectures like BASIC (ignoring that
there are BASIC compilers).
Hope this is what you need.
--
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com
A proverb is no proverb to you 'till life has illustrated it. -- John Keats
- Raw text -