"C" wish list.

tp at ndm20 tp at ndm20
Sat Oct 26 02:45:00 AEST 1985


>	1. Extend the syntax of bit-feilds to ordinary numbers:
>
>		int x:16; /* x is of type int and at least 16 bits long */
>		typedef int int16:16; /* :-> */
>

Specifying the numeric range would  be better  (you don't  have to do
your own conversion to binary, or worry about 1's vs.  2's
complement.  It also encourages more correct coding.  How many of you
would code  int x:22;  rather than  int x:32;  even if  that were the
smallest range that would do the job?  On my machine  (Harris, 24 bit
ints, 48 bit longs) you just wasted 3 bytes.  

>	2. Allow auto aggregate initialisations:
>
>		Why not? If you can pass structures this can hardly be
>		considered horridly inefficient.

Sounds good, but  I pity  the naive  novice that  doesn't realize the
overhead and uses it indiscriminantly!  

>	3. Allow constant aggregates:
>
>		Currently only strings can be used this way, but wouldn't it
>		be nice to be able to say ioctl(2, TIOCSETC, {...});? Or to
>		combine execv and execl as exec(name, {args})? BCPL
>		allowed this, and I miss it.

Sounds good, but we'd need a syntax that didn't conflict with blocks.
Braces are taken.  

>	4. Allow true block structuring:
>
>		outs(s) char*s; {
>			outc(c) char c; {...}
>			tputs(s, outc);
>		}

Maybe, but not that way (I used Pascal for a while.   That  is one of
its  misfeatures.    Possibly  a  way  to  declare  that  a  function
definition was neither static nor  external, but  only visible within
another function in the same file that declared it as  static.  Seems
to me, though,  that you  can accomplish  most things  you would want
this for by making the  function static  in the  file containing only
the functions that need it.  So  what if  the other  functions in the
file can see it?  You wrote them too, so you can avoid any problems.

>	5. Add some real programmability to cpp.
>
>		I still haven't been able to write an assert() that satisfies
>		me... If you allowed '#foo' at other places than the beginning
>		of lines, and made it evaluate constant expressions. Maybe a #{
>		and #} instead of using backslash escapes for long lines...

Yeah! I want to be able to write a macro that will expand into a
something containing conditional compilation, and I would like to be
able to get info from the parser (#if constant($1) comes to mind).
Those 2 allow macros that optimize on particular constant arguments,
which is often possible in some applications. 

One of my own:

How about a good middle exit loop construct? That way I wouldn't
have to implement my own and get flamed for it :-) The syntax on
this is tricky though, and I don't feel like being flamed about it
right now, so I won't bother giving it a shot. Note that while () s;
and do s;...;s while() are both special cases of a middle exit loop,
and ... no I had better shut up.

Terry Poot
Nathan D. Maier Consulting Engineers
(214)739-4741
Usenet: ...!{allegra|ihnp4}!convex!smu!ndm20!tp
CSNET:  ndm20!tp at smu
ARPA:   ndm20!tp%smu at csnet-relay.ARPA



More information about the Comp.lang.c mailing list