Wondering how it's done...

This is a discussion on Wondering how it's done... within the C++ Programming forums, part of the General Programming Boards category; Hey! I love how certain functions allow developers to pass parameters that are constant. For example, some function to set ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    118

    [Solved] Wondering how it's done...

    Hey!

    I love how certain functions allow developers to pass parameters that are constant. For example, some function to set window properties might only accept the following for arguments:

    • SCREEN_FULL
    • SCREEN_WINDOWED
    • SCREEN_NONE
    so you would pass along something as such:

    Code:
    window.setup(SCREEN_FULL);
    Now, obviously these aren't set types (such as intergers, strings, whatever), so they must be defined as a structure somewhere. I just can't figure out how such setup is done.

    Can someone point me to an API that does such, possibly something small for me to understand, so that I can figure out how this sort of thing is done?

    Thanks so much!
    FlyingIsFun1217
    Last edited by FlyingIsFun1217; 12-25-2007 at 02:08 PM.

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,413
    Are you looking for enum?
    Code:
    enum eMyEnum
    {
    	TYPE_ONE,
    	TYPE_TWO,
    	TYPE_THREE
    };
    
    void foo(eMyEnum Arg)
    {
    }
    
    int main()
    {
    	foo(TYPE_ONE);
    	return 0;
    }
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    118
    Yes! That seems to be exactly what I'm looking for!

    Thanks, and Merry Christmas

    FlyingIsFun1217

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,413
    Merry Christmas to you too.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just wondering.
    By Aliaks in forum C++ Programming
    Replies: 5
    Last Post: 06-12-2009, 09:48 PM
  2. wondering about people here
    By moemen ahmed in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 07-08-2002, 09:33 PM
  3. wondering
    By xlordt in forum A Brief History of Cprogramming.com
    Replies: 35
    Last Post: 03-01-2002, 06:05 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21