Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > .nothing

Reply
Thread Tools

.nothing

 
 
bob
Guest
Posts: n/a
 
      04-19-2012
Why did the .h get dropped from many files? For instance, why did vector.h become vector and iostream.h become iostream?
 
Reply With Quote
 
 
 
 
Marcel Müller
Guest
Posts: n/a
 
      04-19-2012
On 19.04.2012 15:57, bob wrote:
> 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
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      04-19-2012
On 4/19/2012 9:57 AM, bob wrote:
> 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
--
I do not respond to top-posted replies, please don't ask
 
Reply With Quote
 
Vlad from Moscow
Guest
Posts: n/a
 
      04-19-2012
On 19 Ğ°Ğ¿Ñ€, 17:57, bob <(E-Mail Removed)> wrote:
> 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.
 
Reply With Quote
 
Christopher Pisz
Guest
Posts: n/a
 
      04-19-2012
On 4/19/2012 8:57 AM, bob wrote:
> 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.




 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      04-20-2012
On Thu, 2012-04-19, Marcel Müller wrote:
> On 19.04.2012 15:57, bob wrote:
>> 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.


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

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
Paul N
Guest
Posts: n/a
 
      04-20-2012
On Apr 19, 2:57*pm, bob <(E-Mail Removed)> wrote:
> 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?
 
Reply With Quote
 
Richard Damon
Guest
Posts: n/a
 
      04-21-2012
On 4/19/12 9:57 AM, bob wrote:
> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments