.nothing

B

bob

Why did the .h get dropped from many files? For instance, why did vector.h become vector and iostream.h become iostream?
 
M

Marcel Müller

Why did the .h get dropped from many files? For instance, why did vector.h become vector and iostream.h become iostream?

No idea. Most likely because the changes including the namespaces were
no longer source compatible.
But I have no idea why the extension got completely dropped instead of
using e.g. .hpp or whatever. Win Explorer and some other applications
dislike files without extensions. AFAIK only Mac and OS/2 use name
independent file types in meta data. And *nix can reasonably live
without the extension.


Marcel
 
V

Victor Bazarov

Why did the .h get dropped from many files? For instance, why did
vector.h become vector and iostream.h become iostream?

I guess in the mid-nineties there were development systems coming out
where definitions and declarations aren't necessarily kept in files, so
the Committee decided to abandon the "header *file*" concept and instead
introduce the "header" concept that might or might not correspond to a
named external storage area ("file"). Extensions are irrelevant when
name has nothing to do with the file system on which the compiled code
resides.

V
 
V

Vlad from Moscow

Why did the .h get dropped from many files?  For instance, why did vector.h become vector and iostream.h become iostream?

Because before accepting the C++ Standard different C++ compilers use
different extensions for C++ headers as, for example, hxx, hpp (or
others) that to distinguish C++ headers from C headers. For example
two headers, <string.h> and <string.hpp>, could be present in a C++
implementation.

So the Committee decided to remove extensions for C++ headers and to
prefix with letter 'c' for C standard headers . Though any
implementation internally may use the same extensions for headers as
it used them before.
 
C

Christopher Pisz

Why did the .h get dropped from many files? For instance, why did vector.h become vector and iostream.h become iostream?

To give interviewers a way to distinguish between C programmers and C++
programmers when they made the mistake of asking for C/C++ programmers,
but were really looking for C++ programmers or were really looking for C
programmers.
 
J

Jorgen Grahn

No idea. Most likely because the changes including the namespaces were
no longer source compatible.

I always thought about it as a migration path to C++98. When you
migrated, you removed the .h and did the updates needed to cope
with the std:: namespace.
But I have no idea why the extension got completely dropped instead of
using e.g. .hpp or whatever. Win Explorer and some other applications
dislike files without extensions. AFAIK only Mac and OS/2 use name
independent file types in meta data. And *nix can reasonably live
without the extension.

Not just "reasonably" -- there are a few things in Unix which depend
on file naming conventions (C++ source files and object files come to
mind) but those are exceptions to the general rule.

/Jorgen
 
P

Paul N

Why did the .h get dropped from many files?  For instance, why did vector.h become vector and iostream.h become iostream?

I'm wondering whether the vast difference between <string> and
<string.h> has any bearing on this question?
 
R

Richard Damon

Why did the .h get dropped from many files? For instance, why did vector.h become vector and iostream.h become iostream?

I will note, besides the other comments that have been made, that the
standard does not require that <vector> does not need to reside in a
file with the name "vector" (or even in a file). It is quite legal and
proper for a compiler to define that when including a file with a name
without an extension, the compiler will also look for that same file
with the, say, .hpp extension, thereby allowing the file to have an
extension for those tools that want/need one, but also to look in source
files the way the standard describes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top