Absolute size of 'short'

William E. Davidsen Jr davidsen at steinmetz.ge.com
Wed Aug 10 03:28:08 AEST 1988


In article <1199 at ficc.UUCP> peter at ficc.UUCP (Peter da Silva) writes:
| Not trying to start a war or anything, but how far do you really have
| to stretch the language to allow:
| 
| 	int	a:16;

I proposed something like this to X3J11 in the first year or so (I was
only there two years). What I suggested was size in bytes, allowing:
	int foo*4
	-or-
	int*4 foo;
The feeling was that it was (a) not really needed and (b) too much like
fortran. I like your idea better, but the few cases where you want exact
size rather than minimum size probably don't justify inclusion.

It would be nice some times to be able to specify a bit array in a
struct, as in:
	struct bit_array {
	  unsigned states:3[40];
	};
I think that's a more likely addition, since it adds very little code to
the compiler and can't be any less efficient than does it yourself in a
series of unreadable shifts and ANDs.

I would really like to see a "packed struct," also. This would be a
struct packed on byte boundaries without fill, no matter *how bad* the
code was to use them.
-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list