From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: unused registers, realloc Date: Sun, 3 Aug 1997 10:27:20 +0100 Organization: None Distribution: world Message-ID: References: NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 25 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Georg Kolling writes: >1. How can i prevent GCC from using a certain segment register? > Or doesnt it use all segment registers? (Well, cs for code, ds for data, > ss for stack, fs for _far stuff... es and gs seem to be unused!) %cs, %ds, %es, and %ss are used by gcc generated code, and should therefore be left alone (obviously you could change them within an asm routine of your own, but be sure to put them back when you are done). Some library functions use %gs, but %fs is free for whatever you want to do with it, eg. you can _farsetsel() in your setup code, and as long as you don't change it later, it will stay set to that value. >2. Does realloc always return the same pointer if i try to shrink a previously > allocated chunk of memory? I'm not sure about the gcc malloc implementation, but I have in the past used compilers that did move the block around (it took me forever to work out why my code suddenly stopped working when I changed compiler!). It's probably not a good plan to assume that it will stay in the same place... -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.