casts to (void) [considered harmful]

Walter Bright bright at dataio.UUCP
Thu Aug 8 21:40:11 AEST 1985


In article <4894 at mit-eddie.UUCP> simsong at mit-eddie.UUCP (Simson L. Garfinkel) writes:
>Normally, when I am working on a project that must be transportable, I
>use a file on my system called "COMPILER_DEPENDENCIES.h" On a VAX, this
>file looks like this:
>#typedef int32 unsigned int
>#typedef int16 unsigned short int
>
>On my IBM/PC (lattice C, UGH!), the file is "COMP_DPD.h" and it looks
>like this:
>#typedef int32 unsigned long int
		^^^^^^^^^^^^^ Lattice doesn't support unsigned long!
>#typedef int16 unsigned int

The above syntax won't work on any compiler I've ever heard of. For
Lattice C, try this:

#define int32	long
#define uns32	<cause syntax error>
#define int16	int
#define uns16	unsigned
#define int8	short
#define uns8	char

If you try to port code to Lattice C that uses an uns32, you will get
a syntax error at the location in the code that needs to be rewritten
so it doesn't require an unsigned long.



More information about the Comp.lang.c mailing list