Jump to content
  • Advertisement
Sign in to follow this  
Mehdi_H

Hiding pointers

This topic is 3470 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello I'm developing a C++ "ResourceManagement" library as a part of an educational game engine. The library will develop as collection of classes Like: ResourceManager* rsm = NULL; Resource* rs = NULL; rs = rsm->Get_Mesh( "filename.x" , true ); As you can see in the sample code above , objects didn't allocate using "new" operator , and they also managed by "ResourceManager" class & mustn't be "delete". This is known that target users are not experienced in C++ programming , So I want to do some thing to hide pointers from them to not "new" or "Delete" objects & limit them to use the framework. How Can I do this? Do you suggest some "typedef" or what? please share your experiences with we. thanx

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Mehdi_H
This is known that target users are not experienced in C++ programming , So I want to do some thing to hide pointers from them to not "new" or "Delete" objects & limit them to use the framework.


Some random thoughts on your situation:

Have you considered using a scripting engine to expose this functionality to the end user? Using a scripting language would allow you to hide a lot of the tedious and advanced functionality of the C/C++ languages. Additionally, the end user would not be required to compile the source code in order to see their results. It could be as simple as them using notepad to create a few files that are saved into some specified folder. The CPython and Lua scripting engines (for example) provide a way for you embed them in your software. Additionally they also provide a way to expose your objects, functions, etc to the end user.

What is your target audience? How much experience with programming do they have? We would be able to make better suggestions if we knew.

Share this post


Link to post
Share on other sites
Ever heard of RAII? Even professionals don't like dealing with pointers it seems.

BTW: What form of learning are you planning on offering? If these are simple beginning programmers, then I like the scripting idea. If you're using C++ because these programmers should be able to handle doing more low-level code, then why shield them from resource acquisition? Why not introduce them to it, or at least practice them in it?

I know they might leak resources, but you can also catch this and inform them of the problem! Or, let them make their own bed, afterwards forcing them to lay in it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!