From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!think!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.ada Subject: Re: if UNIX then USE_C ?? (was: Reasons for drop) Message-ID: <34196@news.Think.COM> Date: 22 Feb 90 21:51:01 GMT References: <27187@cup.portal.com> <18175@megaron.cs.arizona.edu> <5476@crdgw1.crd.ge.com> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA List-Id: In article <5476@crdgw1.crd.ge.com> oconnordm@CRD.GE.COM (Dennis M. O'Connor) writes: >mike@cs (Mike Coffin) writes: >] but the operating system itself is optimized for running C programs. >If we allow that UNIX is optimized for anything ;-), just what >are these C-specific optimizations that favor C and C++ over Ada ? The most obvious way in which a particular OS is oriented towards a particular language is when it comes to data being passed between application programs and OS routines. Unix kernel routines and system library routines expect things like null-terminated strings and structures laid out the way that system's C compiler lays them. Programs written in other languages often need to transform data when passing it into and out of the OS. Another area of language bias is documentation. Unix manual pages for subroutines generally describe the invocation mechanism and argument types in C syntax. Ada representation clauses may be useful for solving some parts of the first problem, but such programs are not portable. Further, the manual pages are written portably, so they don't describe argument representation. In order to write the rep spec for a structure being passed to a system routine you would have to go through the C compiler documentation and find out how it lays out structures (hopefully this is documented). These problems aren't as bad so long as programs stick to OS-independent libraries, such as stdio for C and the standard packages that Ada provides. However, the data transformation overhead is still there, buried inside the library implementation. >Sorry, I disagree. Operating systems provide a "virtual machine" >for the applications programs to execute on; compilers provide >a "virtual machine" for the programmer to write programs for. But there's opportunities to optimize when the two virtual machines have similarities. For instance, both the Unix VM and the C VM share the same string abstraction, so it is never necessary to convert C strings to Unix strings. >An operating system that is only able to efficiently support one >language or one family of languages is an inadequate operating system : Unfortunately, many OSes are inadequate. The Mac OS is Pascal-oriented, Unix is C-oriented, Genera (the OS on Symbolics Lisp Machines) is Lisp-oriented, Multics is PL/I-oriented, etc. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar