ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi everybody. I have a modest knowledge of shell and am able to write scripts. I wonder if it will be better to proceed to learn C++ or just to try learn shell better. I intend to do some personal home and office application programming
So what are the possibilities of c++ over shell?
Thank you
Click here to see the post LQ members have rated as the most helpful post in this thread.
Technically, you don't need to know it, yet, if you want to become proficient with linux and programming, then yes, you will want to learn C/C++, even some assembly
Your title question is easy to answer: does a regular linux user need C++ knowledge ? Certainly not.
But ...
Quote:
Originally Posted by joham34
I intend to do some personal home and office application programming
C++ is the best language.
A typical Linux user doesn't do applications programming. Many different languages could be used for applications programming. Probably more Linux programs have been written in C than in C++. I can't give any concise argument, especially one that would convince an inexperienced programmer, but I am certain that C++ is the best (currently available) language for serious programming projects.
I intend to do some personal home and office application programming
Well, the shell can only take you so far - have you considered something like Python? I like it for the "odd-jobs" I come across, and it's much nicer to use and easier to learn than C++, and won't have you tearing your hair out because of memory allocation errors.
So what are the possibilities of c++ over shell?
Thank you
Entirely different things. Shell is not meant for actual programming. There are many programming languages for different purposes, it would be hard to tell which one would be the best for you.
Of course not. In many sense it's the worst language. Looks like it was designed to ensure the programmers' job security.
Remember our recent discussion on debugging C++ templates ?
But C++ is a (necessary ?) evil in modern world. Remember, I've many times given this link: http://yosefk.com/c++fqa/ ? ... Remember, once one could hardly imagine a world without slavery.
No. It is recommended to be familiar with shell, regular expressions (so you'll use sed/awk) and one scripting language (python/perl). But this is also optional.
Quote:
Originally Posted by johnsfine
C++ is the best language.
No, it isn't. It is one of more powerful languages, but there are tasks for which C++ is not very suitable.
All languages have their uses.
Right. There are big flaws in the ways C++ supports many features that are missing entirely from every other popular language.
Having programmed big projects for MANY years with and without those language features, I'm quite sure flawed is better than missing.
You have conveniently omitted http://yosefk.com/c++fqa/ . Quite an interesting read on C++ as a whole.
...
One of the stupidities of C++ which is on the surface is the 'const' qualifier. A typical good C++ program has a lot of 'const' in its source, and rightly so. Which just proves my point - 'const' should have been the default - like in OCaml, for example.
My favorite default language is Perl. It looks like Lua is a good scripting language (though some people find it slower than Perl/Python). Lua appears to be simple/straightforward compared to Perl/Python. And pretty advanced on the other hand.
No, not at all. BASH, the default shell in most Linux distros, is quite powerful and can do much more than you may think, especially when combined with helpers like AWK.
If you want to know more about what makes Linux tick then maybe you should learn C.
Consider C++, Java, or other languages if you want to write graphical programs or object oriented programs to be used by others.
You have conveniently omitted http://yosefk.com/c++fqa/ . Quite an interesting read on C++ as a whole.
The text in question has been criticized and is a good flamewar fuel. It would be better if everybody stuck to "*I* don't like it so *I* don't use it".
Quote:
Originally Posted by Sergei Steshenko
Which just proves my point
"Proving a point" is a waste of time, if a "point" doesn't always have a practical application. Everybody has an opinion, so let's not start another language war. You're free to use Ocaml. You're also free to make your own C++ derivative.
Quote:
Originally Posted by Sergei Steshenko
On topic.
My favorite default language is Perl. It looks like Lua is a good scripting language (though some people find it slower than Perl/Python). Lua appears to be simple/straightforward compared to Perl/Python. And pretty advanced on the other hand.
It might be a good idea to use/learn something that is more frequently used. Lua (afaik) is less common than Perl/Python, so it might be a better idea to learn Perl or Python.
One of the greatest features of Unix/Linux is that ... "the choice is yours with regards to "how you choose to do something!"
When you contrive to ask (Unix|Linux) to do "anything at all," you will do so by constructing "a command," and that "command" will ultimately consist of "an (executable...) file."
And that file (can...) will begin with: #!handler_name
(What is affectionately known as "shebang.")
In other words, when you enter (almost) any command, the shell will forthwith decide that "it isn't a built-in command that I recognize, therefore it must be the name of some file, and therefore I will first look for 'shebang.'" If the shell finds a 'shebang,' it will invoke the specified handler_name program and ask it to carry out the command.
"Okay, okay, okay... so what's thebottomline here?" It is very-simply this:
You can (write and) run a command (that is written in...) any language that you please in Unix/Linux, and noone on Earth will know or care.
Therefore: "do you need C/C++ knowledge?" Uhh... nope!!
Do I, personally, "know C/C++?" Yes. Intimately.
Have I had need to use that knowledge in the last two dozen(!) (out of more than thirty(!!!)) years? "Thankfully ... no! "
"Shebang" has (delightfully...) dispatched "the arkane" to the (entirely proper...) nether-regions of: "Get 'er done!"
Last edited by sundialsvcs; 12-08-2011 at 06:34 PM.
...
"Proving a point" is a waste of time, if a "point" doesn't always have a practical application. Everybody has an opinion, so let's not start another language war. You're free to use Ocaml. You're also free to make your own C++ derivative.
...
Bad defaults causing extra typing are obviously bad. Because of extra typing. It's not a matter of (not) liking a language in a sense like one may like green and dislike brown.
I don't quite understand "You're also free to make your own C++ derivative". OCaml (as many other functional languages) has by default immutable "variables". While C/C++ do not have them immutable by default.
I wouldn't do a C++ derivative. A language as capable as C++ should be designed from scratch not taking into account "C" legacy.
FWIW, OCaml is a language with automatic memory management and with performance quite close to the one of C/C++. As such it can be quite convenient/useful for a whole lot of tasks. But there are some tasks requiring complete control of HW and manual memory management - OCAml is not for such tasks.
A very key point of the Linux/Unix environments is that, no matter what you may find yourself doing, "you are standing on the shoulders of giants." After all, the entire Unix(R) project started when a couple of Bell Labs researchers stared at the guv'mint funded (and committee-driven into-the-ground) Multics project, and said to themselves, "I Can Do That! (on a PDP-7) ..." and then set out to prove it. (And they did.)
One of the first (and at the time, most earth-shattering) conclusions that they made was that you don't have to make "a significant new operating system" in assembly language. (Such a notion was fairly heretical at the time ...) You can, in fact, use "C" to build an operating system, soup to nuts.
But another equally-important discovery was: "you don't have to use 'C' for everything, and you probably shouldn't."
The good folks who gave us Python ... or Perl ... or Ruby ... or Haskell ... or (fill in the blank) ... what have they done? Well, for one thing, they have given us "fantastically well-crafted C/C++ programs," otherwise known as "the core implementing technologies of their language-of-choice." Because they have done their very-arcane job so very well, we can write truly-crappy programs and actually get away with it! ...
We have "an embarrassment of riches" with regards to our selection of technologies that are equally and very-readily available to us. Therefore, we don't have to "dive to the basement" with technologies like C/C++ merely to make the digital computer do what we want it to do. Instead, we can avail ourselves of other tools (all of them, of course, amazingly-cleverly written in C or C++ ...) to "get from Point A to Point B" much more quickly and cheaply. And, thanks to "shebang," the end-user will neither know nor care how exactly we worked our Magickal Spell. (Or, for that matter, that we worked any magick at all...)
Unix/Linux ... The World Is Your Oyster.
Last edited by sundialsvcs; 12-08-2011 at 09:00 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.