[EMAIL PROTECTED] wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Thu, Sep 29, 2005 at 07:59:01PM +1000, Erik de Castro Lopo wrote: > > For just about everything you can do with a pointer in C there is > > a better, easier, less error prone way to do the same thing in > > O'caml and write less lines of code to do it. > > How about writing a network protocol stack.
It is certainly possible to write such a beast in a language without pointers. I believe quite a bit has been done in this area with Java. > You get a packet and all > you know about it is that here is a block of memory. You then have > to figure out what sort of packet it is, how long it is and what > structure to give it. C handles this very nicely with pointers to > structures that can be cast into whatever you need. The C way (with pointers) leads to non-portable and difficult to maintain code. There are better, safer ways to do it without pointers. However, for a low level task like this, I still think well written, portable C is better than Java and/or O'Caml. > > The one exception > > I can thing of is writing devices drivers and operating systems > > where you need to direct access to harware. > > If you are talking about I/O ports, you can always write a pair > of functions to write and read from I/O and these can be added to > any language (possibly even as inlines if the language supports that). There are people writing an OS in O'caml. Even though I really like O'Caml I still think this is a bad idea. IMO, C is still the best language for implementing low level OS features no matter how flawed it is as a language. My real complaint about C is that it is a really bad language for work with linked lists, sets, hash tables and other high level data structures. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "Religion is a magic device for turning unanswerable questions into unquestionable answers." -Art Gecko, Wombat Discord-1, 128649 -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html