By rchrd on Jun 13, 2007
There's a new article on the Sun Studio SDN portal:
|By Dmitry Mikhailichenko, Sun Microsystems, St Petersburg, Russia, June 2007||
This article gives an overview of the following C-language extensions (part of the GNU C-implementation) introduced in the Sun Studio 12 C compiler. Although these extensions are not part of the latest ISO C99 standard, they are supported by the popular gcc compilers.
- The typeof keyword which allows references to an arbitrary type
- Statement expressions that make it possible to specify declarations and statements in expressions
- Block-scope label names
The article also demonstrates how to use the new C compiler features for creating generic macros on example of linked-list manipulation-routines. Such macros semantically mimic C++ Standard Template Library, support arbitrary data types and provide strict compile-time type-checking.