While talking about useful additions, how about this one??
Karl Heuer
karl at haddock.ISC.COM
Wed Feb 10 07:50:52 AEST 1988
In article <131 at ghostwheel.UUCP> ned at ghostwheel.aca.mcc.com.UUCP (Ned Nowotny) writes:
>[Re "struct *" for a generic pointer to a structure]
>I don't want to mix pointers to different structure types, but I do want
>to write generic code which manipulates complex objects (e.g. linked list
>managers).
How about writing "struct generic *", where "struct generic" is never defined?
This is already syntactically and semantically legal.
>As a rational, consider that given "int a, b;", "int *a_ptr;" declares a
>pointer which may freely point to either "a" or "b"
Yes; so "int *" is a pointer to any int. But it can't point to a short int or
a long int. The analogy is pretty weak, I'd say.
>In fact, given: "typedef int a_int; typedef int b_int;" [both cc and lint
>allow mixing of the two types].
That's because typedef creates a new name for an existing type, rather than a
new type. You want dimensional analysis? I'm working on it.
Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint
More information about the Comp.lang.c
mailing list