Jump to content
  • Advertisement
Sign in to follow this  
openglJunkie

Common Header Files

This topic is 3498 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Why do some header files not have an extension ".h"? For example, the header file for file streaming is just "fstream" not "fstream.ext" where 'ext' is any extension.

Share this post


Link to post
Share on other sites
Advertisement
Those are template files. They usually don't have an extension to remind the programmer that they can behave differently than a header.

Share this post


Link to post
Share on other sites
Quote:
Original post by Nypyren
Those are template files. They usually don't have an extension to remind the programmer that they can behave differently than a header.

Incorrect. cmath, cstdlib, ctypes?

All header files in C and C++ had .h extensions prior to the standardization of C++. When C++ was standardized in 1997, the new standard library headers dropped the .h prefix to distinguish them from the pre-standard versions, and then libraries brought over from C had a 'c' prepended to their names. So, for example, fstream.h and iostream.h became fstream and iostream, respectively, while math.h, stdlib.h and stdio.h became cmath, cstdlib and cstdio.

Share this post


Link to post
Share on other sites
Ah, that's good to know. In console game programming, we're typically stuck with SDKs and engines that are still written in the same fashion as 15 years ago, which still include all of the .h extensions. Literally the *only* time I've ever seen a header without an extension was with very new (VS.Net+) implementations of STL.

Stuck with old-style SDKs for the console, and a wholesale switch to C# on PCs, you can imagine how rarely I've seen them without ".h".

Share this post


Link to post
Share on other sites
Quote:
Original post by Nypyren
Ah, that's good to know. In console game programming, we're typically stuck with SDKs and engines that are still written in the same fashion as 15 years ago, which still include all of the .h extensions.

Having an .h extension is not a sign of archaism. The lack of extensions only applies to headers from the C++ Standard Library. Just wanted to clarify that, because the language above suggests a little confusion. Modern C++ libraries and SDKs have .h extensions.

Those headers can be interesting to read through. Scary, but still interesting. [smile]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!