CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,825

    Re: Do C++ programmers need to know Linux perfectly as well?

    Quote Originally Posted by wolle View Post
    I deleted the post on my own initiative because I realized it might be offensive to Linux/C programmers.

    Each forum has a limit for what's passable and I didn't want to push it but if you feel it's acceptable please restore it.
    [Post restored with minor edit]
    Last edited by 2kaud; October 15th, 2017 at 08:30 AM.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  2. #17
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: Do C++ programmers need to know Linux perfectly as well?

    I'd say to take Linus Torvald's comments with a grain of salt: while it is clearly representative of what he expects of Linux kernel developers, and reflects his opinions of those who would program in C++ for Linux, it isn't representative of the varied opinions of C and C++ that you can find among programmers who program for Linux using C and/or C++. I have indeed encountered the type of programmers that wolle mentioned, but it seems to me to be a contrived stereotype. Mind the different cultures involved, but don't be prejudiced as every workplace, team, or project is different.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  3. #18
    Join Date
    Oct 2008
    Posts
    1,456

    Re: Do C++ programmers need to know Linux perfectly as well?

    Quote Originally Posted by tomy12 View Post
    Going to C is backing one step, while a clever person moves frontwards. I'm a fan of C++ and will never leave it for c.
    Thanks very much for your comments.
    this is a wrong attitude in my opinion; C++ is not a ‘clever’ version of C, you don’t use one or the other based on how smart you are or on which fan you are of.

    C and C++ have different stregths and, despite sharing a similar syntax and being designed to be tightly interoperable, are totally different languages that diverged considerably in the last few decades.

    C++ is capable of much more powerful abstractions, but this happens at the cost of a considerably more complex object model. As a result, it’s comparatively much harder to guess what a compiler will generate by looking to a piece of C++ code, if possible at all, and it’s comparatively much harder to ensure correctness and portability of lower level operations ( unless restricting to, ehm, the type system inherited from C ). Yes, C++ gives you all the tools to write lower level code if necessary but if (in your job) you find yourself in the need of tightly controlling space and time too often, C++ becomes antieconomical compared to C, this is what Linus is talking about and it makes a lot of sense honestly(*).

    as an example, I'd bet very few programmer could implement std::vector<T> out of their head, without violating aliasing rules, object lifetime rules, alignment, etc... ( etc... ). Now, it's ok if you need to do this once or just few times in the lifetime of your product ( or none, if you use existing libraries ) but if this turns out the norm and you're not a library writer, then C is a much better suited tool.

    (*) please, note that I do love C++ and I seldom ( if not ever ) code in C ...

  4. #19
    Join Date
    Feb 2017
    Posts
    677

    Re: Do C++ programmers need to know Linux perfectly as well?

    Quote Originally Posted by laserlight View Post
    I have indeed encountered the type of programmers that wolle mentioned, but it seems to me to be a contrived stereotype.
    I hope you're right because Linus Torvalds isn't just anybody and when the top dog barks the puppies are likely to yelp along.

    Even though Mr. Torvalds' main concern is the Linux kernel his standing is such that his tone of voice and personal views considerably influence the whole of the Linux community. He should've known better than to publish that C++ rant.
    Last edited by wolle; October 17th, 2017 at 12:32 AM.

  5. #20
    Join Date
    Feb 2017
    Posts
    677

    Re: Do C++ programmers need to know Linux perfectly as well?

    Quote Originally Posted by superbonzo View Post
    C and C++ have different stregths and, despite sharing a similar syntax and being designed to be tightly interoperable, are totally different languages that diverged considerably in the last few decades.
    C isn't just tightly interoperable with C++, C is an integral part of C++. Each new C++ standard specifies which C standard it's based on. So since C is in the DNA of C++ it's not like you are avoiding C by using C++.

    Still there are small (and annoying) differences between the C of C++ and the C language. That's undeniable but the major divergence isn't due to that but to the massive evolution of the part of C++ that isn't C.

    I'm sure there are situations where the C language is the best choice but ever so often the C of C++ would be equally fine. It may even be so that C often is used simply because it's in the comfort zone of everybody concerned whereas C++ is a scary alien (that you better hate).

    Unlike what many seem to think, C++ is not an all-or-nothing proposition. It's a perfectly fine strategy to use C of C++ as a baseline and then cherry-pick functionality from C++ that suits the situation.

    This is the strategy Lockheed Martin took for their Joint Strike Fighter (F-35) project. They even enlisted Bjarne Stroustrup, the inventor of C++, to help work out suitable C++ guidelines called JSF++. Here's a presentation by Mr. Stroustrup where JSF++ is used as an example starting on page 25,

    http://www.automotive2010.de/program...-Cplusplus.pdf

    and here's a version of the complete guideline,

    http://www.stroustrup.com/JSF-AV-rules.pdf

    C++ becomes antieconomical compared to C, this is what Linus is talking about and it makes a lot of sense honestly(*).
    The Linux kernel project started as a relatively small program with like ten thousand lines of code. Over the years it has grown to a huge beast and the number of lines now amount to millions.

    Mr. Torvalds has openly admitted that there are quality problems. The kernel is bloated and huge and too complex. It has become inefficient and infested with bugs no one dares to correct for the fear of making things worse.

    https://en.wikipedia.org/wiki/Criticism_of_Linux

    Well, it's easy to write a small C program that is lean and mean. The problems come with growth as is typical for the procedural programming paradigm. It's possible to avoid this by enforcing object oriented and functional techniques on C code right from the start but apparently this has not been done with Linux. So here we are with a situation that is far from "economical" in spite of the alleged efficiency of C.

    I'm not claiming using C++ would've been any better but it certainly would've been possible as the JSF project above indicates (where C++ even displaced Ada actually). And there are more examples of big complex programs of a systems nature being written in C++ like say several of the Java Virtual Machines.
    Last edited by wolle; October 17th, 2017 at 12:27 AM.

  6. #21
    Join Date
    May 2009
    Location
    Boston
    Posts
    364

    Re: Do C++ programmers need to know Linux perfectly as well?

    As a practical note, I program in c and c++ using the gnu compilers in cygwin. Cygiwn provides a linux like environment that runs under windows. This allowed me to learn my way around linux (essentially the bash command line and associated tools) and also to program code that will compile, link, and run on either linux or windows.

    As has been mentioned, there are differences in how the languages interact with the operating system that are important to understand. Methods for creating a new process, inter-process communication with pipes and shared memory, and others, are different in linux and windows, so any program that needs that functionality needs to be abstracted so that the right parts of your code base get compiled and linked depending on the OS your are building for. Overall, that is not that bad of an issue to manage.

    I also like the eclipse IDE for c++ as it will run on either windows or linux. In my business, we need to program for all the different OSs in use, so it's nice to have your projects in an IDE that you can use on any platform.

    LMHmedchem

  7. #22
    Join Date
    Oct 2008
    Posts
    1,456

    Re: Do C++ programmers need to know Linux perfectly as well?

    Quote Originally Posted by wolle View Post
    Unlike what many seem to think, C++ is not an all-or-nothing proposition.
    nenver said that, actually I claimed the exact opposite.

    Quote Originally Posted by wolle View Post
    [...]in spite of the alleged efficiency of C.
    you missed the point; this has nothing to do with efficiency as such, it has to do with correctness, that is proving that some low level operations will actually respect you requirements ( at the very basic, having defined behavior on some (set of) envirnoments ). This requires detailed knowledge of the language object model and evaluation semantics.
    Last edited by superbonzo; October 17th, 2017 at 04:00 AM.

  8. #23
    Join Date
    Feb 2017
    Posts
    677

    Re: Do C++ programmers need to know Linux perfectly as well?

    Quote Originally Posted by superbonzo View Post
    nenver said that, actually I claimed the exact opposite.
    you missed the point;
    It may also be that you said that and that I got your point but we'll never know because I'm not going to reply. I never do when someone argues ad hominem.

Page 2 of 2 FirstFirst 12

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured