lkml.org 
[lkml]   [2007]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: Kernel Development & Objective-C
From
On Sat, Dec 01, 2007 at 12:19:50AM +0100, J.A. Magall??n wrote:
> I think BeOS was C++ and OSX is C+ObjectiveC (and runs on an iPhone).
> Original MacOS (fron 6 to 9) was Pascal (and a mac SE was very near
> to embedded hardware :) ).
>
> I do not advocate to rewrite Linux in C++, but don't say a kernel written
> in C++ can not be efficient.

Well I am pretty sure the micro kernel of OS X is in C, and certainly
the BSD layer is as well. So the only ObjC part would be the nextstep
framework and other parts of the Mac GUI and other Mac APIs they
provide, which all at some point probably end up calling down into the C
stuff below.

> C++ (and for what I read on other answer, nor ObjectiveC) has no garbage
> collection. It does not anything you did not it to do. It just allows
> you to change this
>
> struct buffer *x;
> x = kmalloc(...)
> x->sz = 128
> x->buff = kmalloc(...)
> ...
> kfree(x->buff)
> kfree(x)
>
> to
> struct buffer *x;
> x = new buffer(128); (that does itself allocates x->buff,
> because _you_ programmed it,
> so you poor programmer don't forget)
> ...
> delete x; (that also was programmed to deallocate
> x->buff itself, sou you have one less
> memory leak to worry about)

But kmalloc is implemented by the kernel. Who implements 'new'?

--
Len Sorensen


\
 
 \ /
  Last update: 2007-12-04 18:57    [W:0.241 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site