[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: [LIH] Linux for Unix and gcc
[x-posting to LIP - as this is more on topic there. fup2 LIP, please]
Diwakar Ranganathan forced the electrons to say:
> thanks Gautham! the error message did say something
> about int. sorry Binand, i just didnt want to enter
> the programmers' list without being a programmer :)
Well, the Chinese say something about a thousand mile journey starting
with a single step...
> so, c has a version for each OS?
No. C has an international standard, originally published by ANSI,
generally known as C89. ISO (ISO is an international organisation, whereas
ANSI's scope is only within the USA) adopted it and has been revising
that and trying to come up with an updated standard (called C99), which
is still in draft stage. Older C (ie, earlier to C89) is called K&R C,
as documented by those two guys ("See that PDP 7, Ken?") in their book
(the first edition - what you get here in India is the second edition,
which is more C89) is also still supported by major compilers (including
gcc). These standards define not only the behaviour of C, but its standard
library as well.
Every implementation of the C library provides these standard functions,
and Unix implementations of the library also try to be conformant to
the POSIX standard, which tells the implementor what features an OS
Read the man page of any C function, and look for the section
CONFORMING TO. If it says ANSI/ISO, then it is standard C. If it talks
of POSIX, then it is POSIX, and maybe ANSI.
Unix programmers are better off if they stick to POSIX. Sticking to ANSI
is necessary to write the maximum portable code (and to get answers from
comp.lang.c). Using compiler / library / OS specific extensions (eg.,
far pointers, conio.h, strdup()) should generally be avoided.