LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-02-2012, 09:45 AM   #1
tushar_pandey
Member
 
Registered: Jun 2012
Location: ghaziabad , delhi , india
Posts: 105

Rep: Reputation: Disabled
why this is not allowed in c++ ( linux)


in linux

why in c++ header files with .h extension are not allowed !

but

in c , we can use , .h extesnion files easily !
 
Old 07-02-2012, 09:54 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
I understand it's for the potential clashes with the standard C libraries, it was arbitrarily decided upon a while ago. I't part of the 1998 C++ standard
 
Old 07-02-2012, 10:07 AM   #3
tushar_pandey
Member
 
Registered: Jun 2012
Location: ghaziabad , delhi , india
Posts: 105

Original Poster
Rep: Reputation: Disabled
Unhappy

Now if i ask why we are using .h in c than what would you say !
 
Old 07-02-2012, 10:33 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by tushar_pandey View Post
Now if i ask why we are using .h in c than what would you say !
C came first, they decided to use ".h" for header files because it works. There are enough happy C programmers that it is not likley to change

Why would you expect 2 languages to use the same conventions?
 
1 members found this post helpful.
Old 07-02-2012, 10:35 AM   #5
tushar_pandey
Member
 
Registered: Jun 2012
Location: ghaziabad , delhi , india
Posts: 105

Original Poster
Rep: Reputation: Disabled
thanks ... pixellany !
 
Old 07-02-2012, 01:03 PM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator Response

Moved: This thread is more suitable in <Programming> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 07-02-2012, 01:39 PM   #7
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by acid_kewpie View Post
I understand it's for the potential clashes with the standard C libraries, it was arbitrarily decided upon a while ago. I't part of the 1998 C++ standard
There is nothing that prevents those developing in C++ to use .h as the extension for header files. Some developers like to use .hpp, but AFAIK, there is nothing in the C++ standard that mandates that one uses that particular extension. I've worked on many projects where .h has been used.

As for clashes with standard C header files, that's nonsense too. The compiler will attempt to find the header file(s) specified by the programmer by searching its include path(s). Which ever header file that is found first is the one that is used -- and please note, that a header file is NOT a library. It is a file containing the specification of the constants, macros, functions, classes, and/or even templates that are available for one to use within a library (or other source file module). Typically header files do not contain any code; the exception is when defining templates.
 
1 members found this post helpful.
Old 07-02-2012, 08:05 PM   #8
tushar_pandey
Member
 
Registered: Jun 2012
Location: ghaziabad , delhi , india
Posts: 105

Original Poster
Rep: Reputation: Disabled
thanks ... dwhitney67 !
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Method Not Allowed: The requested method POST is not allowed for the URL /writedhcp.p WiWa Linux - Networking 15 01-06-2011 01:20 PM
Tracking user logins that was allowed and not allowed eswanepoel Linux - Security 3 08-02-2006 04:37 AM
SlackWare :Method Not Allowed The requested method POST is not allowed for the URL slack31337 Linux - Software 0 04-08-2006 06:09 PM
Am I allowed to ask/solicit for help not related to Linux slackist LQ Suggestions & Feedback 10 01-13-2006 05:27 AM
Linux Host no Root login allowed or so it says? Other Linux Distros? mattnedgus Linux - Newbie 6 02-24-2005 03:22 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration