|
-
October 22nd, 2008, 02:32 PM
#1
global map<> not expanding
I've posted this in 3 other forums over the last week but haven't recieved any answers. Basically, I need to know why a global map doesn't expand when added to.
Here's my previous post at experts-exchange, which is the most thorough:
http://www.experts-exchange.com/Prog..._23835913.html
Here it is at
http://www.c-sharpcorner.com/Forums/...ThreadID=49016
assuming most people wont have EE memberships
And again at
http://www.byond.com/developer/forum/?id=669122
Well, this is my first post at codeguru, for whatever that's worth.
-
October 22nd, 2008, 07:30 PM
#2
Re: global map<> not expanding
Code:
listOfPlayers[num] = Player1;
1) If there is already a "num" key in the map, this line of code just overwrites the original "num" key, i.e. nothing is added.
2) You shoud show us a main() program that attempts to add to this map. We don't know if something does or doesn't work unless we see something that actually drives the code that doesn't work.
3)
Code:
extern "C" bool R_CONTROLLER_API CreatePlayer(int num)
Not good.
A "bool" is a C++ type, not a 'C' type -- you cannot predetermine that a "bool" will be the same size on different compilers or versions of the compiler, or is a consistent size given certain compiler options. Use 'C' types that are the same size (Windows types such as LONG, for example).
Regards,
Paul McKenzie
-
October 22nd, 2008, 07:57 PM
#3
Re: global map<> not expanding
The most likely reason a global variable wouldn't be changed when you expect it to be is if a local variable with the same name is shadowing it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|