LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Is all Unix & Linux system is made by C++? (https://www.linuxquestions.org/questions/programming-9/is-all-unix-and-linux-system-is-made-by-c-333704/)

Lancelot1914 06-15-2005 12:27 AM

Is all Unix & Linux system is made by C++?
 
hi to all,

Just to be clear to me..am a newbie..
Is all Unix & Linux system is made by C++?

I'm going to start learning program in C++..
Where can i donwload this program..? and sample projects..to learn step by step..and learn from you guys..

and it is true that you can create a GUI using C++?

Pls give me sample projects in GUI and code to be my reference..

Pls help me..how to start..and what should remember when it comes to programming...

Thanks a lot,


___________________________________________
"You can't be a master, if you don't know how to be a servant"

reddazz 06-15-2005 02:46 AM

The Linux kernel is mainly written in C. KDE is mainly written in C++ and GNOME in C.

Lancelot1914 06-15-2005 08:06 PM

THANKS for the help..
 
Thanks..a lot..I research it from the google..

Lancelot

jonaskoelker 06-15-2005 08:51 PM

Quote:

Is all Unix & Linux system is made by C++?
No.

As has been pointed out, Linux (the kernel, that is) is written in C, and so is gnome.

Most of the base system (ls, cp, mv, ln, true, false, seq, diff, make, sed, grep, awk, gzip, bzip2, tar, ...) is written in C.

Most likely, programs that are part of a desktop environment are written in the language of that environment (i.e. C for gedit (`GNOME Notepad'), C++ for the kde equivalent).

The rest of the `application programs' are written in a variety of languages:
btdownloadgui -- Python
azureus -- Java
firefox -- C++ (I would think)
whitespace -- Haskell
(http://compsoc.dur.ac.uk/whitespace/index.php)

Quote:

I'm going to start learning program in C++..
Where can i donwload this program..?
You mean the compiler? If you have a decent distro, it's already installed; the compiler executable is `g++'.

Quote:

and sample projects..to learn step by step..and learn from you guys..
Try to find a fairly small but usable program written in C++ (which some will claim to be a contradiction in terms).

Quote:

And it is true that you can create a GUI using C++?
It's not a part of the standard, but there are plenty of gui libraries. wxWindows is one.

Quote:

Pls give me sample projects in GUI and code to be my reference..
have a look at krenju

Quote:

Pls help me..how to start..and what should remember when it comes to programming...
Well, grab a good tutorial and get started.

---

By the way, I recommend that one learns both OOP and C before studying C++; for OOP, you might want to look at python or java.

<OT>I think java sucks, due to it being a bondage-and-discipline language (http://catb.org/~esr/jargon/html/B/b...-language.html), but it's up to you what you pick.</OT>

hth --Jonas

lowpro2k3 06-15-2005 09:23 PM

Quote:

Originally posted by jonaskoelker

By the way, I recommend that one learns both OOP and C before studying C++; for OOP, you might want to look at python or java.

<OT>I think java sucks, due to it being a bondage-and-discipline language (http://catb.org/~esr/jargon/html/B/b...-language.html), but it's up to you what you pick.</OT>

hth --Jonas

I just posted in a similiar thread, but I'm going to have to speak out for all the C++ programmers out there :D

You do NOT need to know C before learning C++. In fact you might pick up some (dare I say it??) 'frowned upon' habits in C++ world while your spending your beginning time learning C (casting when unnecessary, not passing by reference when you could, refusing to use C++ strings, and overuse of structs compared to classes to name a few). Not that these are bad, but you wont be the most popular member of a C++ team when you try to force your C habits on your group members. And obviously vice-versa.

Enough rambling, listen to the chief: http://www.research.att.com/~bs/bs_f...l#prerequisite

syg00 06-15-2005 10:40 PM

Quote:

the "chief"
I never saw a project for which C was better than C++ for any reason but the lack of a good C++ compiler.
Wonder what the kernel maintainers think about that :D:D:D

yapp 06-16-2005 04:16 AM

Quote:

And it is true that you can create a GUI using C++?
Depends on what you like to do.
The biggest "problem" with C/C++ is the fact both languages only supply the basics. You need libraries (like KDE, GNOME, Qt, Gtk) to make something useful.

* If you want to write a KDE application, use the KDE/Qt libraries to create a KDE-like-GUI.
* If you want to write a GNOME application, use the Gtk libraries to create a GNOME-like-GUI.
* If you want to write a cross-platform application, Qt 4 will be a great choice for Open Source applications. wxWindows/Gtk can be used for commercial applications too.

Before you start, a good tutorial about C++ won't hurt. Find something that includes pointers, references and classes/objects. If you start writing KDE/Qt applications, you don't need to have much more knowlegde, because Qt and KDE provide the remaining stuff (like networking for example), and make C++ development a breeze.


Each C/C++ application consists of a lot of plain text files, you could write them in KWrite for example. But an environment like KDevelop makes stuff easier to use, and also assist some basic tasks, offer a designer for the GUI, etc... Writing the code is still up to you though ;-)

sekelsenmat 06-16-2005 08:22 AM

Re: Is all Unix & Linux system is made by C++?
 
Quote:

Originally posted by Lancelot1914
Just to be clear to me..am a newbie..
Is all Unix & Linux system is made by C++?
Many people already answered this, but noone made it clear that Linux is NOT enterely made in c++ (I even think that it has more c code in it). The kernel has an estimated 15% of Assembler code. A sizable part of the lower systems (kernel, glibc, etc) are built on c. Many administration tools (like urpmi) are actually built with python, a very new language.

Quote:

I'm going to start learning program in C++..
Where can i donwload this program..? and sample projects..to learn step by step..and learn from you guys..
You will need a good IDE (Integrated Development Envirenment). A good GUI on linux is: www.eclipse.org/. It was made for java, mas you can write c++ on it.

Quote:

and it is true that you can create a GUI using C++?
Prepare to suffer ausuhsauhsahusasuahsauhsahusauhsuah

My experience says that gui in c++ = pain.

Dispite what all c++ lovers will say, if you want to build gui I strongly recomend that you start with something more friendly, like java. Eclipse is a very good java IDE, but http://www.netbeans.org/ Netbeans is just subberb. It is as easy to use as VB IDE.

Personally I use Lazarus and Pascal, but I still recomend that you start with java, because Lazarus IDE is still unfriendly compared to netbeans.

[EDIT to Add] It is very important to say that c++, object pascal and java are *very* similar. If you learn one well you know the others. All the concepts are the same, but c++ does not have a good IDE to build gui stuff on it, but java and object pascal have.

jonaskoelker 06-16-2005 08:30 AM

Quote:

You do NOT need to know C before learning C++.
True.

But if you plan on learning both languages, I think it makes (really) good sense to learn C first.

1) Valid C is almost always valid, equivalent C++. While it is unidiomatic, you can make use of what you know already know.

2) Knowing that C++ has once been implemented as a to-C translator, you may be able to better understand the low-level details of C++ (say, vtables and inheritance)

3) You won't get nearly as much annoyed by the `missing features' of C (`and', `or' and `not' to name the minor ones).

---

Of course, if you only want to learn C++, then the correct learning order is [ "C++" ].

my $0.01 (we're having a sale today).

--Jonas

perfect_circle 06-16-2005 09:21 AM

Re: Re: Is all Unix & Linux system is made by C++?
 
Quote:

Originally posted by sekelsenmat
The kernel has an estimated 15% of Assembler code.

I see people repeating this all the time, but I don't think it's completely true.
What I mean is that when you compile your kernel, the percent of the source you use that is written in assembly is a lot lower that 15%. It's just that C is portable and assembly is not. So since the kernel supports many architectures, the assembly part is rewritten for every architecture when most of the C part is portable to all architectures. So in the kernel source there may be 15% of assembly, but the actual part of assembly used for every kernel we compile is a lot lower.
I don't know this for sure, so I may be wrong but 15% of assembly looks pretty high to me.

jonaskoelker 06-16-2005 09:34 AM

Quote:

c++, object pascal and java are *very* similar
Yes: they're all three reasonably fit for object-oriented programming.

No: C++ use templates all over the plates--java doesn't have that yet (I wouldn't know about OP). In C++ you can have objects in addition to pointers to objects. In java you get OOP forced down you throat, you don't get that for C++. I assume that OP has a pascal-like syntax, which makes it quite different from C++ and java.

Quote:

c++ does not have a good IDE to build gui stuff
How about Glade?


And while we're at doing `sales pitches' for our fav. languages, I'd like to present python:

<Python>

1) You can get the job done *fast*
Essentially a cat (a bit stripped down):
Code:

from sys import argv
for fname in argv[1:]:
    for line in file(fname):
        print line

1) (As you see) it has a very intuitive, clean and readable syntax.

2) It multi-paradigm, allowing both for functional, procedural and object-oriented designs.

3) It has a good standard library allowing for easy handling of:
networking (sockets, HTTP, telnet, smtp, gopher, ...), threads, zip/gzip/bzip/tar files, regexes, bytecode to `symbolic bytecode' disassembly, heaps, unit testing, serialization, object persistance, curses, opening and communicating with inferior processes, GNU readline, RPC, sound files and a bunch of other stuff. Basically everything and the kitchen sink (and that's just the *standard* library).

</Python>

cents = min(primesieve(100))

--Jonas

yapp 06-16-2005 01:04 PM

Quote:

My experience says that gui in c++ = pain.
As I've explained before, it doesn't have to be. KDE/Qt is a good example. It offers a large class library, like .Net or Java does, which allows you to write everything. You even get a graphical designer tool to create the contents of all dialogs using your mouse.

sekelsenmat 06-16-2005 03:57 PM

Quote:

Originally posted by jonaskoelker And while we're at doing `sales pitches' for our fav. languages, I'd like to present python:
That is in no way the objective of this thread. I presented Java as a good alternative not because I love Java, and hate the rest (actually I like pascal ehehehehhe), but because it is easier for a beginner (a lot easier) then c++, mainly due the itīs good friendly IDEs and lack of stuff someone new to programming with get crazy with (makefiles, for instance). This thread is about someone that does not know programming and will start, not about "what is the most powerful programming language", a discussion without end.

Quote:

I assume that OP has a pascal-like syntax
Still you woundnīt beliave how modern object pascal introduced by borland more then 10 years ago is similar to c++ and java.

Felipe

lowpro2k3 06-16-2005 06:02 PM

If you understand that programming isn't all pretty GUIs and such, I feel C++ is a very clean language for expressing yourself well. Makefiles are not a part of the C++ language so they have no real need to be brought up in an argument against it.

Code:

[prompt@yourbox]$ cat > hello.cpp << "EOF"
#include <iostream>
using std::cout;

int main()
{
    cout << "Hello World!\n";
    return 0;
}
EOF
[prompt@yourbox]$ g++ hello.cpp
[prompt@yourbox]$ ./a.out
Hello World!
[prompt@yourbox]$

All it takes to get started programming C++ in Linux, and I overly complicated things with cat.

jonaskoelker 06-16-2005 06:22 PM

Quote:

And while we're at doing `sales pitches' for our fav. languages, I'd like to present python:
Ok, badly put--and I may have read a bit too much into your post. Cut me some slack?

Quote:

I presented Java as a good alternative not because I love Java, and hate the rest (actually I like pascal ehehehehhe), but because it is easier for a beginner (a lot easier) then c++
Didn't say that you hated the rest, but I felt a personal preference shining through (which is all right imo) :)

And I agree, java is easier than c++.

Quote:

mainly due the itīs good friendly IDEs
BlueJ? Sorry, but... it sucks when you're used to emacs (see below on holy wars).

That is, of course, my opinion (and opinion only).

Quote:

and lack of stuff someone new to programming with get crazy with (makefiles, for instance).
Makefiles are not inherent to C or C++ (nor only usable for those--off the top of my head: I do xslt processing with makefiles).

But I agree that C++ is `heavier to dance with' than Java.

However, I think that's inherent in the language design--and I actually a bit surprised you didn't address that.

I'll talk more about that shortly.

Quote:

This thread is about someone that does not know programming and will start, not about "what is the most powerful programming language", a discussion without end.
I realise that.

A quick remark on "what is the most powerful programming language", though: assembly. It will let you do anything your machine + OS is capable of doing. There is no higher level of power.
(paraphrase of someone else's words).
I think that's an insightful (but still with-tongue-in-cheeck) point.

Also note that I have to intention of starting a holy war--they never lead to anyone getting converted anyways :D
Not when it comes to editors, or languages, or OSes, or distros, or unified vs. context diffs.
It's all a matter of personal preference.

And of course, there is no `best programming language'--any such proposition is easily refuted with the question "Best for what?".

If the answer is "For learning how to program", then I claim that python may be a good choice--possibly better than java (and *way* better than C or C++).

Because of...
<strike>Oliver Cromwell</strike>

1) The language was designed with teaching in mind
2) It's actually easy to learn (i.e. the design was successful)
3) It's still useful and powerful (i.e. it's not Logo or VB :p)

A comparison with java:
http://www.ferg.org/projects/python_...e-by-side.html

On its own merits (maybe compared a little bit with perl):
http://www.linuxjournal.com/article/3882

Interview with Bruce Eckel (author of `Thinking in (java|C++)') about python (from time to time compared to java):
http://www.artima.com/intv/tipping.html

Its homepage:
http://www.python.org

And some learning material:
http://www.ibiblio.org/obp/thinkCSpy/

Of course, we shouldn't argue about what language OP should choose--that *his* decision :)

What we should do is provide guidance. You provided some very good guidance (pascal or java over c++)--I happen to think that python is *even* better. Some if it comes from the fact that I dislike Java for being a bondange-and-discipline language, too hyped and dictated too much by marketing and too little by competent geeks.
(and pascal (but I wouldn't know about obj. pascal) is B&D too).

Python is not--see `multi-paradigm programming' (which is nearly impossible with B&D languages).

to OP: "You must do what you feel is right, of course".

Quote:

Still you woundnīt beliave how modern object pascal introduced by borland more then 10 years ago is similar to c++ and java.
"These aren't the droids you're looking for" (sorry, couldn't resist).

Okay, so I might have been wrong about pascal, and I believe you. But if it's like C++ or java, then python is still better :p

---

Am I making myself more understandable?

--Jonas


All times are GMT -5. The time now is 04:19 AM.