LWN.net Logo

Sometimes C++ is faster

Sometimes C++ is faster

Posted Jun 18, 2008 21:00 UTC (Wed) by ncm (subscriber, #165)
In reply to: Sometimes C++ is faster by flewellyn
Parent article: Converting GCC to C++

Sorry, f., we're talking here about speed, hence compile-time dispatching.  If you don't care
about runtime cost, all kinds (not to say "sorts") of notational convenience are easy to
support.


(Log in to post comments)

Sometimes C++ is faster

Posted Jun 18, 2008 21:29 UTC (Wed) by flewellyn (subscriber, #5047) [Link]

In CL, if you want compile-time dispatching, you just declare the types of the method
arguments using DECLARE.  Then the compiler sees that and "hard-wires" the method dispatch.

Sometimes C++ is faster

Posted Jun 18, 2008 21:51 UTC (Wed) by ncm (subscriber, #165) [Link]

Does CL support overloading?  Or would you need to give the functions DECLAREd with different
argument types different names?

Sometimes C++ is faster

Posted Jun 18, 2008 21:58 UTC (Wed) by flewellyn (subscriber, #5047) [Link]

You would DECLARE the types of the arguments in the calling function.  Then (in some
implementations, anyway) the compiler would see that the arguments to the generic function are
of a particular type, and do the dispatch at compile-time.  No changes to the called GF
required.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds