From owner-freebsd-questions Tue Aug 15 13:34: 0 2000 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (zoom3-087.telepath.com [216.14.3.87]) by hub.freebsd.org (Postfix) with SMTP id DA31937BBC1 for ; Tue, 15 Aug 2000 13:33:55 -0700 (PDT) (envelope-from mwm@mired.org) Received: (qmail 41387 invoked by uid 100); 15 Aug 2000 20:33:42 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14745.43302.410395.328073@guru.mired.org> Date: Tue, 15 Aug 2000 15:33:42 -0500 (CDT) To: "t g" Cc: questions@freebsd.org Subject: why c? In-Reply-To: <8519396@toto.iv> X-Mailer: VM 6.72 under 21.1 (patch 10) "Capitol Reef" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG t g writes: > i've been trying to learn unix off and on for a while now, and i finally > trashed windoze ;-) now i'm running freebsd 4.0-release (only... no more > windows at all!). > > anyway, when i was in college (not to long ago) i took a number of > programming classes and all but one of them used c++. so, my question is, > why is everything written in c? is it simply because unix was written > before c++, or is c better for an os? Yes, Unix predates C++. I'm pretty sure Unix predated C, as before C there was B, and before B there was BCPL, and the first C compilers were written for Unix. However, the history of the two is to tightly coupled to tell at this distance, so you'd have to ask someone who was there. Yes, C is better for OS work than C++. OS code needs to be close to the hardware, and as efficient as possible. C++ sacrifices efficiency, and possibly the ability to get close to the hardware, attempting to provide a higher level of abstraction. C, on the other hand, includes things so that you can reliably manage hardware. > i'm also interested in a good book on programming operating system if anyone > has a recommendation (doesn't have to be geared toward unix). Well, Lyon's book on Unix makes a good one, though it's a bit dated.