[Coco] C vs. C

Mark McDougall msmcdoug at iinet.net.au
Tue Nov 21 01:03:31 EST 2006


Joel Ewy wrote:

> INPUT statements.  While most of the functions from the standard library
> should work the same or nearly the same between different versions of C,
> they tend to diverge from there.  And there are libraries and libraries
> of functions to do all kinds of system-dependent things, like graphics,
> and GUI stuff, and I/O nitty-gritty, ad nauseum.  

As a general rule, I like to steer clear of the system-specific
functions as far as possible, instead opting for say, POSIX functions
where I have the chance.

Of course, that's heavily dependent on exactly what you're coding. Most
of what I write these days, for example, are small utilities for data
conversion or perhaps 'simulations' of algorithms to be implemented in
hardware or another language less conveniently prototyped. Such
utilities use simple console or file i/o and don't tend to require any
system-dependent libraries. You never know when/where you might want to
re-use or simply just re-run the code one day in the future!

On the occasion that I do want to use graphics, I use the Allegro
library, which is available for both Windows and Linux. Another option
would be a GL-based library or something like SDL (which I've never
used, but is used in several cross-platform emulators, for example).

IMHO, unless you've got your sites on becoming a dedicated platform
commercial programmer, then using 'Microsoft' or 'Borland' libraries is
a very bad choice. Why limit yourself to one platform when there's no
need to? Now I haven't done any DirectX programming myself, but I've
done a reasonable amount of Windows GUI and even some MFC and I wouldn't
wish that on anyone I even remotely cared about! ;) MFC in particular
really is an absolute piece of sh*t!

My advice - try to learn 'generic' C as far as possible. gcc is a good
starting point. If it's graphics you're into, try a multi-platform
graphics library such as Allegro or SDL. Ditto for widgets or GUI (IMHO,
steer well clear or P/NCURSES).

FWIW I've been writing C/C++ for 20+ years on platforms from 8-bit
micros such as 8051 and Z80, up to Wintel, DEC Alpha Linux and SH4; from
micro apps to device drivers to full-blown Windoze GUI apps. That's
plenty of different compilers on plenty of different OS's. You start to
appreciate 'portable' code after a while... ;)

Regards,
Mark



More information about the Coco mailing list