C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 1st, 2003, 08:05 AM
Jason Doucette's Avatar
Jason Doucette Jason Doucette is offline
jasondoucette.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Canada
Posts: 378 Jason Doucette User rank is Private First Class (20 - 50 Reputation Level)Jason Doucette User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 7 h 23 m 8 sec
Reputation Power: 6
Difference between #include <cxxx> and <xxx.h>?

What are the precise differences between:

#include <cstdio>
vs
#include <stdio.h>

(or <cassert> vs <assert.h>)? I used to know, but my memory is failing me.

I always include the .h file, but I know that including the library name includes the .h file, anyway - so what is the difference?

Thanks.

Reply With Quote
  #2  
Old May 1st, 2003, 09:20 AM
3dfxMM 3dfxMM is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 266 3dfxMM User rank is Sergeant (500 - 2000 Reputation Level)3dfxMM User rank is Sergeant (500 - 2000 Reputation Level)3dfxMM User rank is Sergeant (500 - 2000 Reputation Level)3dfxMM User rank is Sergeant (500 - 2000 Reputation Level)3dfxMM User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 21 h 16 m 35 sec
Reputation Power: 13
There isn't a great deal of difference in the two examples you gave. cassert does nothing more than #include <assert.h>. cstdio does a #include <stdio.h> as well as redefining a symbol if it thinks it needs to. I am in the habit of always using the .h files directly so I really can't comment on when you might want to use one rather than the other.

Reply With Quote
  #3  
Old May 1st, 2003, 09:37 AM
M3xican's Avatar
M3xican M3xican is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Italy -> Naples
Posts: 9 M3xican User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to M3xican
Lightbulb header files

cstdio is the C++ version of the C header stdio.h .
its contents are (mostly) the same as that header, but are all contained in the namespace std.

if u use linux u can observ differences editing
/usr/include/stdio.h
and
/usr/include/c++/x.x.x/cstido
where x.x.x. is the version of your compiler

Reply With Quote
  #4  
Old May 1st, 2003, 01:30 PM
Jason Doucette's Avatar
Jason Doucette Jason Doucette is offline
jasondoucette.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Canada
Posts: 378 Jason Doucette User rank is Private First Class (20 - 50 Reputation Level)Jason Doucette User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 7 h 23 m 8 sec
Reputation Power: 6
3dfxMM, yes, I am in the habit of just including the .h files, as well, so I had no idea what the differences were. I never had a problem with just the plain .h files.

M3xican, thanks for your reply. I have taken a look at the cstdio file, and it does just include the stdio.h file, like I expected. So, basically, if you are using C++, the proper file to include would be the cxxxx file, without the .h postfix, so they are contained within their proper namespaces, which was introduced in C++.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Difference between #include <cxxx> and <xxx.h>?


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT