man.bsd.lv manual page server

Manual Page Search Parameters

TYPEOF(3) Library Functions Manual TYPEOF(3)

typeofGNU extension for type of an expression

type
typeof(expression);

The () construct can be used to obtain the type of an expression. The syntax is comparable to that of (), but semantically typeof() operates like a type name defined with .

The following is a typical example of a type-generic macro:

#define MAX(a, b) ({		\
	typeof(a) _a = (a);	\
	typeof(b) _b = (b);	\
	_a > _b ? _a : _b;	\
})

gcc(1), __alignof__(3), attribute(3), offsetof(3)

The typeof() construct is a non-standard, compiler-specific extension.

December 19, 2010 NetBSD-9.2