468,513 Members | 1,870 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

question: typedef's do they belong in header file or in .c files ?

Hello,

I have a question regarding type definitions. I usually put them in
header files. But I recently came over several discussions on the www.
And now I'm not to sure anymore if they go in .c file or in the header
files ?

What would be the correct way ?

Thank you.

Jas.
Nov 14 '07 #1
2 6865
On Nov 13, 6:59 pm, jason <ji...@notmal.comwrote:
Hello,

I have a question regarding type definitions. I usually put them in
header files. But I recently came over several discussions on the www.
And now I'm not to sure anymore if they go in .c file or in the header
files ?

What would be the correct way ?
Header files are for sharing. If you need visibility of the typedef
across two or more source modules, put it in a header file. If the
typedef is used in only one source module, put it there.

Regards,

-=Dave
Nov 14 '07 #2

"jason" <ji***@notmal.comwrote in message
news:47**********************@dreader23.news.xs4al l.nl...
Hello,

I have a question regarding type definitions. I usually put them in
header files. But I recently came over several discussions on the www.
And now I'm not to sure anymore if they go in .c file or in the header
files ?

What would be the correct way ?

Thank you.
IMO, headerers are better.

this is also especially true in my case since I tend to use tools to
autogenerate the headers (function prototypes and so on), and so, not having
types in headers can make a very big mess with said autogenerated
prototypes...

Jas.

Nov 14 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Vu Pham | last post: by
7 posts views Thread by Morenz | last post: by
4 posts views Thread by QQ | last post: by
16 posts views Thread by burn | last post: by
7 posts views Thread by Dennis Myrén | last post: by
12 posts views Thread by spibou | last post: by
12 posts views Thread by Bryan Parkoff | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.