Re: Function calling
Re: Function calling
- Subject: Re: Function calling
- From: Bob Ippolito <email@hidden>
- Date: Wed, 25 May 2005 18:35:22 -0700
On May 25, 2005, at 6:26 PM, Theodore H. Smith wrote:
Of course strongly typed languages can be much faster. Think about it.
MyClass* OtherClass::MyFunc() {
return &this->MyClassField;
}
void MyClass::Increment() {
this->Value++;
}
OtherClass Fred;
for (long i = 0; i < 10000000; i++) {
Fred.MyFunc->Increment();
}
A good C++ compiler will compile this with no functions called! It
will be all tight ASM code. Not that gcc is a good compiler,
though. I think MrCpp (from MPW) could handle these kind of cool
opts. But gcc I'm not so sure if it can do it on C.
As for Obj-C, these kind of opts are often impossible, because Obj-
C is weakly typed.
And with an even smarter compiler (for a more declarative programming
language) like Haskell, the compiler would know the answer already,
and not bother to calculate it all at runtime.
-bob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden