Thread: what happens when sending enumerated data types as parameters to functions

  1. #1
    Join Date
    Jan 2003

    what happens when sending enumerated data types as parameters to functions

    I'm trying to find a way to have objects identify events in the game by sending enumerated types as a parameter in my messaging functions (the way the objects communicate to each other). What is actually going on here, is an integer value being copied and sent by value every time these functions are called? Here's the first few piece of code, if I like this idea I'm going to build on it by adding more enumerations of the type. If you think there's a better way of doing this tell me

    my enumerated type:
    typedef enum {
    activateplayer = 0, activateenemy
    } controller_types;
    One of the functions that processes the controller_types
    void	GameController_t::Activate(controller_types x){
    	switch(x) {
    	case activateplayer:
    		Clients.push_back(new Player);
    and here it is being used
    Im basically trying to be creative and think of good ways to do this, but i don't know if this way is the best

  2. #2
    I lurk
    Join Date
    Aug 2002
    An integer value representing the enumerated type is pushed onto the stack, then the function is called.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 04-19-2006, 11:17 AM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  3. Data types in Unicode
    By Garfield in forum Windows Programming
    Replies: 12
    Last Post: 10-28-2001, 10:48 AM
  4. Need help with simple data types
    By partnole in forum C++ Programming
    Replies: 1
    Last Post: 10-03-2001, 08:36 AM
  5. Using enumerated data types
    By SXO in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2001, 06:26 PM