Skip navigation.
 
mlRe: Cocoa from C++ (dont want to mix it)
FROM : Lemings, Eric B
DATE : Wed Apr 13 23:09:24 2005

On Thu, 10 Mar 2005 06:37:17 -0800, John Stiles wrote:
>
> In C++, the compiler needs to know about the function ahead of time,

or it simply can't compile it.
> In Objective-C, you can just call whatever and the system will either

figure it out and do the right thing at
> runtime, or throw an exception if it can't be done.
> There really isn't a way to meld static and dynamic binding.


And why does C++ does linkage at compile-time?  Well there's a very good
reason for it.  Let's examine both cases: the case where the call is
linked correctly and the case where the call is linked incorrectly.

If the call is linked correctly, there isn't a problem with either C++
or Objective-C.  The C++ implementation however is probably more
efficient since linkage was done at compile-time whereas Objective-C has
run-time overhead associated with making the correct linkage.

Now the case for incorrect linkage.  Would you rather have an link error
occur at compile-time while you're developing the application or at
run-time perhaps after your application is in the field or has already
shipped?

Eric.

Related mailsAuthorDate
mlRe: Cocoa from C++ (dont want to mix it) Lemings, Eric B Apr 13, 23:09
mlRe: Cocoa from C++ (dont want to mix it) Lars Sonchocky-Hel… Apr 14, 21:59