Find the answer to your Linux question:
Results 1 to 6 of 6
I've been using linux for about a year now, I've learned alot since then and know a alot about the insides and all that CLI stuff. A week or 2 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2013
    Posts
    24

    Should I learn C++ instead of C?


    I've been using linux for about a year now, I've learned alot since then and know a alot about the insides and all that CLI stuff. A week or 2 ago I started to learn C, since since it's the language the linux kernel is made in and it would probably be useful. So far I've learned basic syntax, strings, declaring variables, basic I/O, and some other things. A couple months ago I tried to learn Java, but failed miserably because of the unefficient syntax, and I realized it was a very useless language for me because I want to do more low level stuff while java is just a virtual machine thing and it's just stupid like that. But my question is should I learn C++ with barely any programming experience before? I don't want to learn any of that python or java script stuff. Or should I start with C instead?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,755
    C++ is C with classes, and classes makes object-oriented programming MUCH easier than with C. You can use C inside C++ programs without problem (I do it all the time) since some API's are C only, such as inotify, md5 and other cryptographic hashing functions, etc. Still, you need to currently use "pure" C for Linux kernel/device-driver development. Think of C as a high level assembler language - good for low-level development (hardware integration and such), but not so great for complex systems development where being able to use inheritance and polymorphism can be real effort multipliers.

    So, to answer your question - learn both! If you learn C++, you learn how to program in C also, but there are things you can do easily with C++ that are VERY difficult in C.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Sep 2013
    Posts
    24
    But what I also want to do low-level things? Would C++ still suffice?

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    949
    I would start with C because it you learn more about the low level of programs interacting with the computer and managing resources. Once you master C then moving to C++ or any other language will be easy and you will be better at those language because you understand the relationship between program and hardware.

  6. #5
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    949
    Quote Originally Posted by owemeacent View Post
    But what I also want to do low-level things? Would C++ still suffice?
    If you want to do low-level then C is the way to go, it the closest to asembly language of all the high level languages. Plus if doing real work like writing device drivers and so on, C++ adds too much overhead. To see for yourself write simple hello world program and compile as C then same code as C++ and look at the difference in size of the executables C++ is bigger to handle the object oriented aspect even if you aren't writing OO code.

  7. #6
    Just Joined!
    Join Date
    Sep 2013
    Posts
    24
    What about desktop environments and cli interfaces? I knkw they've made very good ones in C (gnome, bash), but would it be even better in C ++??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •