Path: chuka.playstation.co.uk!news From: gil@snsys.com (Gil Jaysmith) Newsgroups: scea.yaroze.programming.codewarrior Subject: Re: Initializing the heap Date: Fri, 31 Oct 1997 12:00:45 GMT Organization: SN Systems Lines: 39 Message-ID: <3459c0fd.1431258@news.playstation.co.uk> References: <01bce566$fdb8c1a0$a5bf43ce@wkwerner> <34596659.40D5@charlie.cns.iit.edu> <01bce5de$a390af80$6fbf43ce@wkwerner> Reply-To: gil@snsys.com NNTP-Posting-Host: gil.snsys.com X-Newsreader: Forte Free Agent 1.11/32.235 "Wayne K. Werner" wrote: >Yeah, but I still find it problematic to init heap in the source. >Heap is >a feature of the language itself. I think maybe GNU should be >"upgraded" to >handle this issue correctly, and CW shouldn't be "downgraded" to be >compatible. Then compiler specific issues of heap inititialization >would >be no issues at all. Everyone seems to enjoy assuming that GNU should be changed to fit in with someone else's compiler which they happen to be using. Why exactly is this? (GNU predates CodeWarrior; CodeWarrior could be considered wrong on that basis for everything different which it does.) Heap management is a library thing, not a language thing. An initialisation call is required, and giving control of the heap-init routine to the programmer could be said to enhance flexibility. The fact that you didn't realise the difference until it happened isn't necessarily your fault but certainly isn't the GNU toolchain's fault. Insisting that GNU should be 'upgraded' so it generates specifically-named section/segment descriptor variables for 100% CodeWarrior compatibility comes across as a bit petulant, squire - not to mention uninformed, since GNU 'ld' supports symbol aliasing so you can cheerfully create all the descriptor variables you need... ;=) The startup code for a particular platform invariably has to make assumptions about what you might want to do yourself and what you don't want to know about. Correctly initialising the GP register is not something you'd typically care about, so startup code does that for you. Initialisation of the heap from the end of your program to the end of memory is *probably* safe, but dynamic loading of graphics data circumvents that assumption, so you either need to reserve the space in BSS or override the InitHeap call yourself. It's too bad that you have to do this differently depending on the platform, but #ifdef was invented for situations like this. - Gil