Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-pcd!hpcvra!frankw From: frankw@hpcvra.CV.HP.COM (Frank Wales) Newsgroups: comp.sys.handhelds Subject: Re: What If - someone wrote a HP-48SX C compiler? Message-ID: <21580039@hpcvra.CV.HP.COM> Date: 22 Mar 90 20:58:52 GMT References: <8697@rosevax.Rosemount.COM> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 43 In article <21580037@hpcvra.CV.HP.COM> I wrote: >There are certain fundamental difficulties: > >[pile of stuff relating to system calls, libraries and other things] In article <4686@cbnewsl.ATT.COM> bobp@cbnewsl.ATT.COM (robert.phillips) writes: }I think the C compiler idea is pretty bogus, but I think you may be missing }the boat about C. A C language implementation can work perfectly well }without open(),close(),read(),write(),fork(),exec(), signal(),setjmp(),etc. I know; I've used some -- I didn't think it appropriate to bring up discussions about different types of C implementation beyond my comment: It would be a genuinely interesting and educational exercise to attempt to write something which could take C code (ignoring the standard libraries and providing compatible alternatives which accessed the 48's resources) and output something which implemented that program on the 48, either by producing RPL code or assembler code. Essentially, you end up writing all your own libraries and system calls, and have 48C as the language name, or whatever. Building such a thing would not be easy, but could be rewarding. }I think one of the reasons Frank mentions all the UNIX system }calls is to apply the argument of portability. Indeed, one of the chief }advantages of C is its portability, and this advantage would be sacrificed }by any reasonable implementation on the HP (non-portable custom math library }to call built-in functions, non-standard i/o, etc.). Exactly. And to be pragmatic about it, the generated code would need to coexist with the RPL operating system, which limits the kinds of routines that would reasonably be written to special-purpose, the-only-alternative-is-assembly routines. This is still a significant use, but there is a fairly limited number of people who would benefit from such a compiler being available, because for most programming uses the 48 is anticipated for, RPL is good enough. (And the 48 is first-and-foremost a calculator, not a personal computer.) But don't let us put you off. ;-) -- Frank Wales, Guest of HP Corvallis, [frank@zen.co.uk||frankw@hpcvdq.cv.hp.com] Zengrange Ltd., Greenfield Road., LEEDS, England, LS9 8DB. (+1)-503-750-3086