[comp.lang.c] use of #ifndef machinetype

gilbertd@p4.cs.man.ac.uk (Dave Gilbert) (03/12/91)

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@p4.cs.man.ac.uk - The MTBF of a piece of equipment  -
-                G7FHJ@GB7NWP             - is inversly proportional to its   -
------------------------------------------- importance                        -