Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!ames!elroy!smeagol!jplgodo!wlbr!scgvaxd!stb!michael From: michael@stb.UUCP (Michael) Newsgroups: news.admin,news.groups Subject: Re: Easy way to remove binary groups Message-ID: <1693@stb.UUCP> Date: Wed, 29-Jul-87 13:37:18 EDT Article-I.D.: stb.1693 Posted: Wed Jul 29 13:37:18 1987 Date-Received: Sat, 1-Aug-87 05:09:15 EDT References: <266@brandx.rutgers.edu> <8225@utzoo.UUCP> <272@brandx.rutgers.edu> <2524@hoptoad.uucp> <174@genghis.UUCP> Reply-To: michael@stb.UUCP (Michael) Organization: STB BBS, La, Ca, USA, 90402 Lines: 34 Xref: mnetor news.admin:758 news.groups:1301 In article <174@genghis.UUCP> sns@genghis.UUCP (Sam Southard) writes: >As long as I'm here, I might as well put my two cents in. I do most, if not >all, of my work on a PC/AT. A lot of the sources that are put out make some >assumptions about sizeof(int) among other things. They won't work on the AT >with the Lattice C or Microsoft C under DOS or the Xenix C compiler (I have >all three). It's not the fault of the compiler, but the assumptions of the >author (to avoid flames, I'd like to be able to make such assumptions, and >they are not unreasonable. Unfortunately, the are also not valid for the AT). Here's an excellent solution to this problem (and one I wish the IBM compilers had as an option, at least): Make sizeof int == sizeof long == sizeof char* == sizeof void*. In other words, if you need 32 bits for a long, then ints will also be 32 bits. Pointers need (if I understand correctly how the segmemting works) 48 bits (32 offset, 16 for seqment reg). So, make all ints/longs reserve 48 bits of data and only use 32. PRESTO! You can assign ints/longs/char *'s interchangibly. You can forget to force that NULL to a (char *)NULL and it will still work. Realize: C is NOT ASSEMBLY (except on the pdp-11 :-). It is a language. Whether that implementation is super-optimized or is portable is a decision made by the compiler author. Commercial ones go for the efficiency. PD ones can go for portability. (in case you're curious: I have a C compiler for a 68000 that has a flag for 16 bit, efficient ints vs. 32 bit, compatible ints. Since the O/S was written with a different compiler (32 bit ints), the option was the only way to go). -- : Michael Gersten seismo!scgvaxd!stb!michael : Copy protection? Just say Pirate! (if its worth pirating)