use of #ifndef machinetype
Dave Gilbert
gilbertd at p4.cs.man.ac.uk
Wed Mar 13 01:04:04 AEST 1991
Hi,
I'm presently porting a lot of PD C source to a machine which is neither UNIX
or MSDOS (an Acorn Archimedes). What annoys me is when you have machine dependant
chunks of code - obviously I dont mind #ifdef MSDOS do something - this is sensible.
What I dont like is #ifNdef MSDOS - this presumes that every machine which is not
MSDOS is UNIX (for example) - and as my machine well knows this is wrong.
What I reckon is the best method is:-
#ifdef UNIX
unix blah
#define gotmachine
#endif
#ifdef MSDOS
MSDOS blah
#define gotmachine
#endif
#ifndef gotmachine
an obvious error
{ comment saying that it is not a known machine }
#endif
Or something to the same ends - dont presume a machine is either UNIX or MSDOS!
Dave
--
-------------------------------------------------------------------------------
- Dave Gilbert - gilbertd at p4.cs.man.ac.uk - The MTBF of a piece of equipment -
- G7FHJ at GB7NWP - is inversly proportional to its -
------------------------------------------- importance -
More information about the Comp.lang.c
mailing list