Thread: Quickie: typedef

  1. #1
    Registered User
    Join Date
    Sep 2002

    Quickie: typedef

    Can you make it treat it explicitly, so that this:

    typedef DWORD FLAG;
    void funcx(FLAG flag1)
    	cout << "FLAG" << endl;
    void funcx(DWORD int1)
    	cout << "INT" << endl;
    int main(void)
    	FLAG x12;
    	DWORD x13;
    	return 0;
    Will work, outputting "FLAG INT"?

    I need this so that I can make it differenciate between a FLAG and a DWORD.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    typedefs do not make a new type but rather just give an existing type a second name/alias.
    So your example will not work properly. To do this you would need to use a class not a typedef.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :-

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  3. Please STICKY this- vital to MSVC 6 dev - BASETSD.h
    By VirtualAce in forum Game Programming
    Replies: 11
    Last Post: 03-15-2005, 09:22 AM
  4. build errors migrated from dx9b to dx9c sdk
    By reanimated in forum Game Programming
    Replies: 4
    Last Post: 12-17-2004, 07:35 AM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 12:54 PM