LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ? about C++ (https://www.linuxquestions.org/questions/linux-newbie-8/about-c-507438/)

BigBen09 12-04-2006 01:51 PM

? 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.

BigBen09 12-04-2006 02:08 PM

anyone have anything for me?

StargateSteve 12-04-2006 02:11 PM

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++.

BigBen09 12-04-2006 02:16 PM

is there another site you might know about? forum if possible

jschiwal 12-04-2006 02:40 PM

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++.

eerok 12-04-2006 04:49 PM

Quote:

Originally Posted by BigBen09
is there another site you might know about? forum if possible

http://cboard.cprogramming.com/

matthewg42 12-04-2006 05:41 PM

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.

StargateSteve 12-05-2006 08:47 AM

There is in mine ;) just some drivers I'm working on.

jstephens84 12-05-2006 12:13 PM

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.

eerok 12-05-2006 12:25 PM

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

jschiwal 12-05-2006 11:34 PM

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 ).

matthewg42 12-05-2006 11:44 PM

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++.

jschiwal 12-07-2006 01:26 AM

That is correct.


All times are GMT -5. The time now is 03:57 AM.