LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-04-2006, 01:51 PM   #1
BigBen09
LQ Newbie
 
Registered: Dec 2006
Posts: 3

Rep: Reputation: 0
? about C++


Hi I am new 2 the forum and programming I am taking a C== programming class and was wondering if this is Linex? this might be a dumb question but I am vary new 2 programming. We use Microsoft Visual Studio and I have some questions about file I/O and argc/argv, but I need 2 know if I am in the right place.

Last edited by BigBen09; 12-04-2006 at 02:06 PM.
 
Old 12-04-2006, 02:08 PM   #2
BigBen09
LQ Newbie
 
Registered: Dec 2006
Posts: 3

Original Poster
Rep: Reputation: 0
anyone have anything for me?
 
Old 12-04-2006, 02:11 PM   #3
StargateSteve
Member
 
Registered: Dec 2006
Location: UNM
Distribution: Debian Lenny
Posts: 107

Rep: Reputation: 15
I believe you meant C++ and Linux? No, C++ is not Linux. One is a language, the other is a kernel written in said language. No this would most likely not be the right place to ask about C++.
 
Old 12-04-2006, 02:16 PM   #4
BigBen09
LQ Newbie
 
Registered: Dec 2006
Posts: 3

Original Poster
Rep: Reputation: 0
is there another site you might know about? forum if possible
 
Old 12-04-2006, 02:40 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
You could post C++ questions in the programming forum on this site. The kernel and many of the utilities are written in C while Gnome and KDE programs are normally written in C++.
 
Old 12-04-2006, 04:49 PM   #6
eerok
Member
 
Registered: Nov 2005
Location: Canada
Distribution: Mint, Debian
Posts: 168

Rep: Reputation: 32
Quote:
Originally Posted by BigBen09
is there another site you might know about? forum if possible
http://cboard.cprogramming.com/
 
Old 12-04-2006, 05:41 PM   #7
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Quote:
Originally Posted by StargateSteve
I believe you meant C++ and Linux? No, C++ is not Linux. One is a language, the other is a kernel written in said language. No this would most likely not be the right place to ask about C++.
I'm cringing at myself for being such a pedant, but there is no C++ in the Linux kernel.
 
Old 12-05-2006, 08:47 AM   #8
StargateSteve
Member
 
Registered: Dec 2006
Location: UNM
Distribution: Debian Lenny
Posts: 107

Rep: Reputation: 15
There is in mine just some drivers I'm working on.
 
Old 12-05-2006, 12:13 PM   #9
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
The linux kernel was written mostly in C but If I remember correctly weren't a couple of parts written in c++. I know almost all drivers written in C.
 
Old 12-05-2006, 12:25 PM   #10
eerok
Member
 
Registered: Nov 2005
Location: Canada
Distribution: Mint, Debian
Posts: 168

Rep: Reputation: 32
Here's what Linus says about C++ and the kernel

Quote:
"In fact, in Linux we did try C++ once already, back in 1992. It sucks. Trust me - writing kernel code in C++ is a BLOODY STUPID IDEA.

"The fact is, C++ compilers are not trustworthy. They were even worse in 1992, but some fundamental facts haven't changed: 1) the whole C++ exception handling thing is fundamentally broken. It's _especially_ broken for kernels. 2) any compiler or language that likes to hide things like memory allocations behind your back just isn't a good choice for a kernel. 3) you can write object-oriented code (useful for filesystems etc) in C, _without_ the crap that is C++."
cf http://kerneltrap.org/node/2067
 
Old 12-05-2006, 11:34 PM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
The kernel is written in C. However it does use some features that were borrowed from C++ and incorporated in ISO C99.
Another difference is that the kernel uses its own runtime library and not the C runtime library. The kernel versions of many functions have the letter k in front of the name, such as kmalloc and kprint.

Some features of the kernel are object-oriented. Such as the VFS file system. You have the super_block structure for example. To operate on a superblock you use functions in the super_operations structure. You have the inode object and a structure of functions to operate on an inode ( struct inode_operations ).
 
Old 12-05-2006, 11:44 PM   #12
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Quote:
Originally Posted by jschiwal
Some features of the kernel are object-oriented. Such as the VFS file system. You have the super_block structure for example. To operate on a superblock you use functions in the super_operations structure. You have the inode object and a structure of functions to operate on an inode ( struct inode_operations ).
Yes, but OO implemented in C, not C++.
 
Old 12-07-2006, 01:26 AM   #13
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
That is correct.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:06 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration