Silly typedef question

This is a discussion on Silly typedef question within the C++ Programming forums, part of the General Programming Boards category; I have a typedef that I'd like to use across multiple files, my question is, what the best way to ...

  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,253
    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%.

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, 03: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, 01:49 PM
  5. build errors migrated from dx9b to dx9c sdk
    By reanimated in forum Game Programming
    Replies: 4
    Last Post: 12-17-2004, 06:35 AM

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