This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Classes and memory usage in C++


Classes and memory usage in C++

Postby j.edwards » Apr 28, 2004 @ 3:26am

User avatar
j.edwards
pm Member
 
Posts: 240
Joined: Oct 29, 2003 @ 11:09am
Location: Australia


Postby joshbu [MSFT] » Apr 28, 2004 @ 4:31am

joshbu AT microsoft dot-you-know-where
Windows CE Software Design Engineer

“This posting is provided “AS IS” with no warranties, and confers no rights.”
joshbu [MSFT]
pm Member
 
Posts: 60
Joined: Apr 10, 2004 @ 12:28am
Location: Redmond, WA


Postby j.edwards » Apr 28, 2004 @ 4:54am

User avatar
j.edwards
pm Member
 
Posts: 240
Joined: Oct 29, 2003 @ 11:09am
Location: Australia


Postby mlepage » Apr 28, 2004 @ 4:01pm

There is a syntax called "placement new" which will allow you to construct an object into existing, preallocated memory. I'm not sure if it is supported in eVC3 or eVC4, but if it is, that's another way to do what you want, without writing your own new operator.

Don't do arcane casting tricks. They are dangerous and there are other, proper ways to do what you want.
www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby Kzinti » Apr 28, 2004 @ 4:48pm

Implementing operator new (and delete) inside his classes is the best (and cleaness) way to do it. Placement new would be the hack to stay away from.
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby hm » Apr 28, 2004 @ 9:48pm

User avatar
hm
pm Member
 
Posts: 201
Joined: Dec 28, 2003 @ 8:47pm
Location: Seattle, WA


Postby Kzinti » Apr 28, 2004 @ 10:23pm

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby joshbu [MSFT] » Apr 29, 2004 @ 6:12pm

joshbu AT microsoft dot-you-know-where
Windows CE Software Design Engineer

“This posting is provided “AS IS” with no warranties, and confers no rights.”
joshbu [MSFT]
pm Member
 
Posts: 60
Joined: Apr 10, 2004 @ 12:28am
Location: Redmond, WA


Postby Kzinti » Apr 29, 2004 @ 6:36pm

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby mlepage » Apr 29, 2004 @ 6:37pm

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby Kzinti » Apr 29, 2004 @ 6:56pm

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby mlepage » Apr 29, 2004 @ 7:05pm

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron