Crystal Space
Welcome, Guest. Please login or register.
October 22, 2017, 06:36:22 pm

Login with username, password and session length
Search:     Advanced search
9063 Posts in 2051 Topics by 77723 Members
Latest Member: Simarlolumor276
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  General Crystal Space Discussion
| | |-+  smart pointers and adress pass
« previous next »
Pages: [1] Print
Author Topic: smart pointers and adress pass  (Read 3257 times)
Posts: 47

View Profile Email
« on: October 29, 2007, 07:26:04 pm »

I have a question:

Do I have to use smart pointers as wel for adress passing?

So imagine I have a smart pointer containing the adress of the engine interface and I want multiple classes to know the adress (player, enemy etc). So I pass on the adress of the interface to those classes from the application class(where it's adress is requested with csQueryregistry). Do I have to use smart pointers as well in the classes I pass the adress on to?
Hero Member
Posts: 1706

View Profile
« Reply #1 on: October 29, 2007, 08:28:03 pm »

You certainly don't have to use csRef in the parameters of the functions. That's just wasteful. As to wether you keep the resulting pointers in csRef or not it is mostly up to you and depends on the situation. If your main class has a ref to the engine and that class is guaranteed to remain in memory all the time then it doesn't make much sense to have a csRef to the engine elsewhere. On the other hand it is also not a big problem. So do what you feel is best here.

Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 3.484 seconds with 15 queries.