Tuesday, November 01, 2005

Programming: GCC and CORBA

GCC4 has been out for a while now, but I still haven't gotten around to looking at it. I came across some GCC compiler optimizations I wasn't aware of. Specifically "__builtin_expect (!!(x), 1)", which means you no longer have to guess that the first conditionals get evaluated first. Nice.

Here is a copy of the optimization header file:

#if __GNUC__ >= 3
# define inlineinline __attribute__ ((always_inline))
# define __pure__attribute__ ((pure))
# define __const__attribute__ ((const))
# define __noreturn__attribute__ ((noreturn))
# define __malloc__attribute__ ((malloc))
# define __must_check__attribute__ ((warn_unused_result))
# define __deprecated__attribute__ ((deprecated))
# define __used__attribute__ ((used))
# define __unused__attribute__ ((unused))
# define __packed__attribute__ ((packed))
# define likely(x)__builtin_expect (!!(x), 1)
# define unlikely(x)__builtin_expect (!!(x), 0)
#else
# define inline/* no inline */
# define __pure/* no pure */
# define __const/* no const */
# define __noreturn/* no noreturn */
# define __malloc/* no malloc */
# define __must_check/* no warn_unused_result */
# define __deprecated/* no deprecated */
# define __used/* no used */
# define __unused/* no unused */
# define __packed/* no packed */
# define likely(x)(x)
# define unlikely(x)(x)
#endif

Looks like GCC finially hit some optimization standards, long way to go yet.

Oh yeah, and VC8 is out. I've been using the beta. Its awesome. (both the IDE and the compiler FYI).

And a note on the CORBA front, TAO is my implementation of choice. A bit of a pain to compile since the VC6 workspace is a bit munted, but its much cleaner than omniORB in my very limited opinion. Work on the component system continues..

No comments: