Article View: comp.os.ms-windows.programmer.tools
Article #705Re: How to implement a Linked List
From: Greg Demichillie
Date: Thu, 17 Dec 1992 17:54
Date: Thu, 17 Dec 1992 17:54
44 lines
2260 bytes
2260 bytes
In article <1992Dec17.084558.9832@nuscc.nus.sg> shah@cherry.NoSubdomain.NoDomain (Shahrin Abdullah) writes: >In article <724532588snz@chrism.demon.co.uk>, chris@chrism.demon.co.uk (Chris Marriott) writes: >|> In article <1992Dec16.062628.3410@nuscc.nus.sg> shah@cherry.NoSubdomain.NoDomain writes: >|> >|> >Hi there! >|> >Does anyone out there knows how to implement a linked list for Windows using >|> >MS C7. I know how to do it in C but in Windows it look tricky. I think I may >|> >need to use the global heap with the GMEM_MOVEABLE flag but I not too sure >|> >of going around doing it. Can anyone gave me some pointer, please. Any >|> >source code sample is also appreciated. >|> > >|> >Shahrin >|> >E-mail shah@iss.nus.sg >|> > >|> >|> If you're using Microsoft C7, you can implement a linked list in Windows >|> in exactly the same way you would for DOS - just use the standard run time >|> library "malloc" function. If you use the large memory model (and there's >|> no reason not to, any more), "malloc" gets mapped onto calls to a pretty >|> good "sub-allocator". >|> >|> Chris >|> -- > >The problem here is that malloc will map the memory allocation to the local >heap. Thus if the node dynamically grow too large the local heap won't be >able to handle that. So the question remain - how do U implement a linear >linked list using the Global Heap? Thanks Chris. > This is incorrect. In versions prior to C7 malloc was implemented by allocating out of the local heap. This is no longer the case. In C7 malloc allocates larger blocks from the global heap and suballocates from them. You CAN just use malloc/free to do your linked list. -Greg -- Greg DeMichillie gregde@microsoft.com -- All opinions are mine, not Microsoft's --
Technical Details
Message-ID:
<1992Dec17.175420.2457@microsoft.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!microsoft!hexnut!gregdeReferences:
<1992Dec16.062628.3410@nuscc.nus.sg> <724532588snz@chrism.demon.co.uk> <1992Dec17.084558.9832@nuscc.nus.sg>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.tools Path: arc1-ca.pugleaf.net!sparky!uunet!microsoft!hexnut!gregde From: gregde@microsoft.com (Greg Demichillie) Subject: Re: How to implement a Linked List Message-ID: <1992Dec17.175420.2457@microsoft.com> Date: 17 Dec 92 17:54:20 GMT Organization: Microsoft Corporation References: <1992Dec16.062628.3410@nuscc.nus.sg> <724532588snz@chrism.demon.co.uk> <1992Dec17.084558.9832@nuscc.nus.sg> Lines: 43