Thread: Silly typedef question

  1. #1
    ...and never returned. StainedBlue's Avatar
    Join Date
    Aug 2009
    Posts
    168

    Silly typedef question

    I have a typedef that I'd like to use across multiple files, my question is, what the best way to accomplish that without re-declaring the typedef in each file? Also, it seems silly to me to stick a typedef in it's own header file.

    Thoughts???
    goto( comeFrom() );

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Put it in a header file.

    If you're using a typedef across multiple source files, there's usually something else (eg declarations of functions that accept arguments of the typedef'd type) which would logically be placed in the same header file. If the typedef needs to go alone into a header file, so be it - odds are something else will eventally need to go into that header as well.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 04:25 AM
  2. typedef question
    By -EquinoX- in forum C Programming
    Replies: 31
    Last Post: 05-03-2008, 09:15 AM
  3. Question regarding typedef
    By esmeco in forum C Programming
    Replies: 2
    Last Post: 04-24-2008, 11:58 AM
  4. A Silly Question!
    By MK4554 in forum C++ Programming
    Replies: 2
    Last Post: 01-13-2006, 02:49 PM
  5. build errors migrated from dx9b to dx9c sdk
    By reanimated in forum Game Programming
    Replies: 4
    Last Post: 12-17-2004, 07:35 AM