Typeof operator in C (Re: An Interesting View of "Strong" Vs. "Weak" Typing)

Peter da Silva peter at ficc.uu.net
Mon Jan 15 03:15:27 AEST 1990


> Check out the GNU CC compiler. It has a ``typeof'' keyword that looks like
> the ``sizeof'' keyword.

Yes, seveal people have pointed me at GCC on this one.

> #define SWAP(a,b) {typeof (a) tmp; tmp=a; a=b; b=tmp;}
                            ^ ^

Are these parens needed? sizeof doesn't need tham.

Does GCC have my other favorite extensions?

	Anonymous aggregate constants. (execv(prog, (char *){"prog", ...})

	The BCPL valof operator. (a = valof { ... return b; }), also
known as the anonymous function.

Both of these were in BCPL, and the former is in PL/M as well...
-- 
 _--_|\  Peter da Silva. +1 713 274 5180. <peter at ficc.uu.net>.
/      \
\_.--._/ Xenix Support -- it's not just a job, it's an adventure!
      v  "Have you hugged your wolf today?" `-_-'



More information about the Comp.lang.c mailing list