Path: utzoo!attcan!uunet!lll-winken!ames!amdahl!pacbell!att!ihlpb!tainter From: tainter@ihlpb.ATT.COM (Tainter) Newsgroups: comp.lang.c Subject: Re: malloc impossible? Message-ID: <9408@ihlpb.ATT.COM> Date: 14 Jan 89 21:44:05 GMT References: <19@xenlink.UUCP> <225800106@uxe.cso.uiuc.edu> <310@twwells.uucp> <9342@smoke.BRL.MIL> <15427@mimsy.UUCP> <9351@smoke.BRL.MIL> Reply-To: tainter@ihlpb.UUCP (55521-Tainter,J.A.) Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 29 In article <9351@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: >Assuming that integers could not also live in floating-point space, >C would not be implementable on such a hypothetical architecture. Sure it can. Just not efficiently. >Consider > union { > double d; > int i; > } u; > u.d = 123.0; > printf("%d\n", u.i); >This is required to work, although the specific value printed of course >depends on details of numeric representation on the specific system. >All data object types in C must be able to live in the same kind of space. >Whatever kind of space that is, is what one would parcel out via malloc(). >Therefore malloc() is implementable if C is (at the very least, along the >lines I indicated in my previous example implementation). This isn't even required to print anything useful. To support this stuff you just give everything an indirection. I haven't thought it completely through but I think this can be fleshed out and even support malloc(). --johnathan.a.tainter