Topic: New Style headers
Author: maxtal@physics.su.OZ.AU (John Max Skaller)
Date: Wed, 15 Jun 1994 11:14:02 GMT Raw View
In article <pjl.771134605@graceland.att.com> pjl@graceland.att.com (Paul J. Lucas) writes:
>>>Just wondering, what are "New Style" headers?
>
>> #include <iostream>
>
>>(no ".h")
>
> Why?
See Pete Beckers explanation: its to do with namespaces.
--
JOHN (MAX) SKALLER, INTERNET:maxtal@suphys.physics.su.oz.au
Maxtal Pty Ltd, CSERVE:10236.1703
6 MacKay St ASHFIELD, Mem: SA IT/9/22,SC22/WG21
NSW 2131, AUSTRALIA
Author: maxtal@physics.su.OZ.AU (John Max Skaller)
Date: Thu, 9 Jun 1994 02:33:23 GMT Raw View
In article <2t14gb$l5t@nwfocus.wa.com> rrowe@chinook.halcyon.com (Robin Rowe) writes:
>Just wondering, what are "New Style" headers?
#include <iostream>
(no ".h")
--
JOHN (MAX) SKALLER, INTERNET:maxtal@suphys.physics.su.oz.au
Maxtal Pty Ltd, CSERVE:10236.1703
6 MacKay St ASHFIELD, Mem: SA IT/9/22,SC22/WG21
NSW 2131, AUSTRALIA
Author: pjl@graceland.att.com (Paul J. Lucas)
Date: Thu, 9 Jun 1994 04:03:25 GMT Raw View
In <Cr3z3o.xD@ucc.su.OZ.AU> maxtal@physics.su.OZ.AU (John Max Skaller) writes:
>In article <2t14gb$l5t@nwfocus.wa.com> rrowe@chinook.halcyon.com (Robin Rowe) writes:
>>Just wondering, what are "New Style" headers?
> #include <iostream>
>(no ".h")
Why?
--
- Paul J. Lucas
AT&T Bell Laboratories
Naperville, IL
Author: olaf@cwi.nl (Olaf Weber)
Date: Thu, 9 Jun 1994 07:26:12 GMT Raw View
In article <pjl.771134605@graceland.att.com>, pjl@graceland.att.com (Paul J. Lucas) writes:
> In <Cr3z3o.xD@ucc.su.OZ.AU> maxtal@physics.su.OZ.AU (John Max Skaller) writes:
>> In article <2t14gb$l5t@nwfocus.wa.com> rrowe@chinook.halcyon.com (Robin Rowe) writes:
>>> Just wondering, what are "New Style" headers?
>> #include <iostream>
>> (no ".h")
> Why?
To make them different from those with ".h" of course.
It has to do with the introduction of namespaces for the standard
libraries. The ".h"-less headers will leave all names in a standard
namespace (call it "std"). The ".h" header would become:
// Long copyright notice.
#include <iostream>
using namespace std;
so that older code will continue to work. There is a discussion of
this the chapter on namespaces in D&E.
-- Olaf Weber
Author: davidt@netcom.com (David Taylor)
Date: Thu, 9 Jun 1994 19:24:31 GMT Raw View
Olaf Weber (olaf@cwi.nl) wrote:
: It has to do with the introduction of namespaces for the standard
: libraries. The ".h"-less headers will leave all names in a standard
: namespace (call it "std"). The ".h" header would become:
: // Long copyright notice.
: #include <iostream>
: using namespace std;
: so that older code will continue to work. There is a discussion of
: this the chapter on namespaces in D&E.
What is "D&E" ?
Dave
Author: pete@genghis.interbase.borland.com (Pete Becker)
Date: Thu, 9 Jun 1994 21:45:59 GMT Raw View
In article <pjl.771134605@graceland.att.com>,
Paul J. Lucas <pjl@graceland.att.com> wrote:
>In <Cr3z3o.xD@ucc.su.OZ.AU> maxtal@physics.su.OZ.AU (John Max Skaller) writes:
>
>>In article <2t14gb$l5t@nwfocus.wa.com> rrowe@chinook.halcyon.com (Robin Rowe) writes:
>>>Just wondering, what are "New Style" headers?
>
>> #include <iostream>
>
>>(no ".h")
>
> Why?
To distinguish them from "Old Style" headers, of course.
-- Pete
Author: pete@genghis.interbase.borland.com (Pete Becker)
Date: Thu, 9 Jun 1994 21:53:10 GMT Raw View
In article <pjl.771134605@graceland.att.com>,
Paul J. Lucas <pjl@graceland.att.com> wrote:
>In <Cr3z3o.xD@ucc.su.OZ.AU> maxtal@physics.su.OZ.AU (John Max Skaller) writes:
>
>>In article <2t14gb$l5t@nwfocus.wa.com> rrowe@chinook.halcyon.com (Robin Rowe) writes:
>>>Just wondering, what are "New Style" headers?
>
>> #include <iostream>
>
>>(no ".h")
>
> Why?
OK, a serious answer...
The ANSI/ISO working paper says that the various library functions and
classes are contained in their own namespace, named 'std'. The new style
headers simply contain the class definitions, function prototypes, etc.,
enclosed in this namespace. In order to use any of these names you must either
qualify the name with 'std::' or you must add a 'using' directive.
In order to preserve existing code, the old style headers will contain
appropriate using directives which will put all of these identifiers into the
global namespace, just like they used to be. The simplest approach, adding
'using std', doesn't work. It affects name lookup, but doesn't actually put the
names in the namespace into the global namespace. The result would be that any
name explicitly qualified with '::' wouldn't be found. So the old style headers
will have to be written with an explicit 'using' directive for each name that
belongs in global scope.
-- Pete
Author: rrowe@chinook.halcyon.com (Robin Rowe)
Date: 7 Jun 1994 06:35:55 GMT Raw View
Just wondering, what are "New Style" headers?
Robin
--
-----------------------------------------------------------
Robin Rowe rrowe@halcyon.com rrowe@hardy.u.washington.edu
Rowe Technology 206-869-7693 C++ training/development
Northwest C++ Users Group Redmond, WA U.S.A.