C structs & A question about octet

BEATTIE twb at hoqax.UUCP
Thu Nov 6 00:22:14 AEST 1986


> OK, next question:  I want to define some types to hold bytes, words, and
> long words, where byte == 8 undsigned bits, word == 16 unsigned bits, and
> long words == 32 unsigned bits.  I want to give them nice names, names
> that imply the number of bits.  I could use u8, u16, and u32, but I
> don't *like* those names.  I thought I had a better plan:
> 	use octet for the byte
> 	use hexdectet for sixteen
> 	use <latin for two>, latin for 30> for 32
> but 32 turned out to be "duotrentet" or something and that's ugly.  So
> does anyone have any better names?  Something nice and intuitive and
> not ugly?  How about Greek?  How do they spell them?
> -- 
> Larry McVoy 	        mcvoy at rsch.wisc.edu, 
>      		        {seismo, topaz, harvard, ihnp4, etc}!uwvax!mcvoy
	
I use my own typedefs for portability.
I simply redefine the typedefs to get the required length and
characteristics.
For example SINT32 is a Signed 32 bit Integer anywhere I go and
P - Positive, U - Unsigned
They are nice and intuitive and not very ugly :-)
My typedefs for the VAX are:
typedef	long		PINT32;
typedef	long		SINT32;
typedef	unsigned long	UINT32;
typedef	long		BIT32;

typedef	short		PINT16;
typedef	short		SINT16;
typedef	unsigned short	UINT16;
typedef	short		BIT16;

typedef	char		PINT8;
typedef	char		SINT8;
typedef	unsigned char	UINT8;
typedef	char		BIT8;

---
Tom.
T.W. Beattie
...!{ihnp4 | houxm | whuxl | ulysses}!hoqax!twb
...!{decvax | ucbvax}!ihnp4!hoqax!twb



More information about the Comp.lang.c mailing list