Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!sei!fs7.ece.cmu.edu!o.gp.cs.cmu.edu!netnews From: Ralf.Brown@B.GP.CS.CMU.EDU Newsgroups: comp.os.msdos.programmer Subject: Re: memory models in TC 2.0 Message-ID: <27c276bf@ralf> Date: 20 Feb 91 12:16:47 GMT Sender: netnews@cs.cmu.edu (USENET News Group Software) Organization: Carnegie Mellon University School of Computer Science Lines: 22 In-Reply-To: <6246@mentor.cc.purdue.edu> In article <6246@mentor.cc.purdue.edu>, schikore@mentor.cc.purdue.edu (Dan Schikore) wrote: }to compile using a different memory model and having some difficulty. What }must be done to use a different memory model? I tried first using the -mc }option on the tcc command line, and I have had all sorts of problems with }the program doing unexpected things. When you change memory models do you }have to specify the change in pointer types? (I also tried this changing }all pointers to far pointers and malloc to farmalloc, etc). Basically, are }there some pitfalls that I have to look out for in changing the default }memory model? Any help would be appreciated. A major pitfall is the assumption that ints and pointers are the same size. You also need to make sure every function which returns a pointer is properly declared/prototyped, or the segment portion of the pointer will be lost. Turn on ALL warnings (-w on TCC) and fix all of the warnings (by adding header files, prototypes, explicit casts, etc) before proceeding. -- {backbone}!cs.cmu.edu!ralf ARPA: RALF@CS.CMU.EDU FIDO: Ralf Brown 1:129/3.1 BITnet: RALF%CS.CMU.EDU@CMUCCVMA AT&Tnet: (412)268-3053 (school) FAX: ask DISCLAIMER? Did | It isn't what we don't know that gives us trouble, it's I claim something?| what we know that ain't so. --Will Rogers