🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.win32
Article #2226

Re: "NEW" in WIN32 ?????????????????????????????????????????????????????????

#2226
From: John A. Grant
Date: Sat, 29 Nov 1997 00:00
43 lines
2945 bytes
Don wrote in message <347fc30b.0@stan.astra.co.uk>...
>I'm new to Win32, however I'd like to know if I can use "NEW" in WIN32, and
>its partner "DELETE"
    Never heard of them. Perhaps you're talking about 'new' & 'delete' :)
    Yes, you can use them. Recommended.

>If I can, what type of memory allocation does it use, compared to these
>functions:
>1)    GlobalAlloc() -- "MOVEABLE?, DISCARDABLE?"
>2)    Heap Functions: HeapCreate(), HeapAlloc().....
>3)    VirtualAlloc() etc...
    It doesn't really matter, as far as you're concerned. Just use new
    & delete. These are portable routines and each compiler can
    implement it any way they choose using whatever system functions
    are available. Most, if not all vendors implement a reasonably
    efficient suballocation scheme that allocates large blocks from
    system memory and then doles it out to you in smaller pieces
    as you require.

    GlobalAlloc() was created for use in pre-Windows 3.1 versions
    because new/delete & malloc/free were *not* recommended.
    That's just because those old versions of Windows couldn't manage
    memory at all and needed your help. The only time you use
    GlobalAlloc() now is for putting a handle onto the clipboard.

>If I can't use "NEW" & "DELETE", Which method is best for making a dynamic
>data structure, with several hundred object in it, each about 200 to
>2200bytes in size?
>I'll be sure to learn that type for use in my program.
    Use new/delete.
>THANKS in advance for any help.
>Please send your responses to: puppy@dog.astra.co.uk


    No. Public questions get public answers. If Usenet consisted
    only of questions and answers were only e-mailed, then
    there wouldn't be much point in reading it, would there?
--
John A. Grant   * I speak only for myself *   jagrant@znrcan.gc.ca (remove
'z')
Airborne Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here.
Technical Details
Message-ID: <65okpk$euv23@nrn2.NRCan.gc.ca>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <347fc30b.0@stan.astra.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10461f,d71ad4d0c9b73da3
X-Google-Attributes: gid10461f,public
X-Google-Thread: 113dfb,d71ad4d0c9b73da3
X-Google-Attributes: gid113dfb,public
X-Google-Thread: fccee,d71ad4d0c9b73da3
X-Google-Attributes: gidfccee,public
X-Google-Thread: fd2c4,d71ad4d0c9b73da3
X-Google-Attributes: gidfd2c4,public
X-Google-Thread: 10015c,d71ad4d0c9b73da3
X-Google-Attributes: gid10015c,public
From: "John A. Grant" <jagrant@znrcan.gc.ca>
Subject: Re: "NEW" in WIN32   ?????????????????????????????????????????????????????????
Date: 1997/11/29
Message-ID: <65okpk$euv23@nrn2.NRCan.gc.ca>
X-Deja-AN: 293605494
References: <347fc30b.0@stan.astra.co.uk>
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Organization: gsc
Newsgroups: comp.os.ms-windows.programmer.win32,fido.win32,microsoft.public.win32,microsoft.public.win32.programmer,microsoft.public.win32.programmer.kernel