Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 08-23-2002, 04:51 PM   #1
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
Standard C++

Recently I read that header files ending with .h (like iostream.h) aren't standard any more, and that standard code uses the .h-free versions, can anybody explain or give a link to explanation on the difference and how to migrate to the new version?
Thanks in advance.
aym is offline   Reply With Quote
Old 08-23-2002, 07:16 PM   #2
Member (9 bit)
 
Join Date: Jan 2001
Location: East Coast, USA
Posts: 320
Send a message via AIM to TMAN
where did you read this? I know that the standard c libraries now have the common convention of no .h but every other library is expected to have .h. I have never heard that this was standard but that it was a common convention like calling your integers nMyInteger.

HTH
TMAN is offline   Reply With Quote
Old 08-23-2002, 07:31 PM   #3
Member (12 bit)
 
Paul Victorey's Avatar
 
Join Date: Mar 1999
Location: MN or WI
Posts: 3,017
It's part of the "new" ANSI C++. And I say "new" only because when I learned ANSI C++, it didn't exist (and my compiler is too old to even allow things like #include <cstdio> instead of the older #include <stdio.h>).

Any new book should teach ANSI C++, with things like the std namespace, etc.

Last edited by Paul Victorey; 08-23-2002 at 07:34 PM.
Paul Victorey is offline   Reply With Quote
Old 08-29-2002, 08:40 AM   #4
Member (7 bit)
 
Join Date: Jul 2000
Location: Australia
Posts: 97
As I recall this is the new standard when including stream library header files when using the new stream libraries.

If you wan't to use the old stream libraries, just add the .h extention.

Note : You cannot use the old and new stream library headers at the same time. It will cause a lot of headache during compilation and linking.
earlboy is offline   Reply With Quote
Old 08-29-2002, 09:09 AM   #5
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
And the rest is exactly the same or what?
Is it only a matter of removing .h?
aym is offline   Reply With Quote
Old 08-29-2002, 10:07 AM   #6
Member (7 bit)
 
Join Date: Jul 2000
Location: Australia
Posts: 97
When using standard c++ libraries don't include the .h extenstion. ( streams, stl, etc. )

When using standard c libraries include the .h extenstion.

As for the csdtio, as Paul mentioned is a new ansi C++ specification, which would mean the cstdio is a standard C++ library header file thus no .h extension is needed.

In addition I think that this cstdio header file was created so that C++ code can include the stdio libraries and conform with the new way of including header files, to make include declaration in C++ uniform.

Hope this helps.
earlboy is offline   Reply With Quote
Old 08-29-2002, 06:24 PM   #7
Member (12 bit)
 
Paul Victorey's Avatar
 
Join Date: Mar 1999
Location: MN or WI
Posts: 3,017
Also, if you're using the new standards, you will need to include the std namespace to make it work like it used to. Otherwise, you'd need to use things like std::cout << "Test";
Paul Victorey is offline   Reply With Quote
Old 08-29-2002, 09:40 PM   #8
Member (7 bit)
 
Join Date: Jul 2000
Location: Australia
Posts: 97
I like adding the namespace in front of the operation of the class being called, instead of declaring a "using namespace". It tells me more detail of which namespace the operatoin belongs to, but then again it's depends on the developer.

Besides it makes you type more, which in effect looks like you are lot busier .
earlboy is offline   Reply With Quote
Old 08-30-2002, 02:30 PM   #9
Member (12 bit)
 
Paul Victorey's Avatar
 
Join Date: Mar 1999
Location: MN or WI
Posts: 3,017
Hehe, I'm sure I'd use the namespace, once I manage to get a decent compiler that supports the newest standards. I use Borland C++ 5.02 which is great(it was free and had a very nice gui/IDE).

I've seen some people who have managed to use the newer Borland compilers as a back-end to the 5.02 IDE, but it didn'
t work for me, I may need to reinstall BC5
Paul Victorey is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:22 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2