A useful construct for C !
Chuck Collins
cpc at AMES-NAS.ARPA
Fri Feb 8 17:16:50 AEST 1985
I have often felt the need for a "typeof" operator, and in cases that
cannot readily be taken care of by typedef. Consider:
#include <sgtty.h>
struct sgttyb get;
saveflags(flags)
(typeof get.sg_flags) flags;
{
This provides a clean way of making two data items match. You wouldn't
suggest that I open up sgtty.h and add a typedef. This example seems
trivial, but I've run into it in much more practical situations.
More information about the Comp.lang.c
mailing list