can we program a hardware with c++ ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RabahMabhoul
    New Member
    • May 2015
    • 6

    can we program a hardware with c++ ?

    hello!

    I was wondering weither I can write a System like ext4 HTFS FAT with c++ programing language, and if there's a link to a book that explain all the fundimental of programming language and how they involved ! please answer back !
  • computerfox
    Contributor
    • Mar 2010
    • 276

    #2
    Rabah,

    What's with all the yelling in the threads?
    As I explained in the original thread, C++ isn't used in too many places other than education as C is still the preferred. C++ is very high-level so systems are especially not written in C++. Even Windows is written in C until it can bring in the .Net framework. C has the best of both worlds, high level and lower level like assembly. C++ was C re-written.

    A simple Google search could have given you more information:


    There would also be memory allocation issues, memory leak issues, functions in C++ that aren't recognized, C++ is not meant for low level programming.

    Here's more information on low level development:


    Hope that helps!

    Comment

    • kiseitai2
      New Member
      • Jul 2007
      • 93

      #3
      I have taken an electronics course before that used C. The reason C is preferred when you are playing with the hardware is mostly because of overhead issues. The problem is not really most of the points computerfox mentioned. The issue is mostly that you may or may not be working with a circuit that has low RAM and storage capabilities (as low as 1KB of RAM and a couple of megs of storage (at best)). C++ has many nice features that on paper makes it a more attractive language than C; however, these C++ features will make your binary fatter and will increase the RAM requirement for your program. C, on the other hand, forces you to rewrite some of these features from scratch and/ or rethink your strategy such that you make leaner and faster code. Now, you may think 1 KB of RAM is nothing, but it is actually a considerable amount when using C and when you write smart and efficient code. Thus, the hierarchy is to write the foundation of your system (low level layer) in C or assembly, write the intermediate components in C++ or other similarly strong language, and write the uppermost layers with languages as simple as scripting languages like Python. My rule of thumb is, if I am constraint by the circuit and/or the feature is critical to my solution to the problem, I should probably use C. I hope my explanation helps.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        All true.

        C++ is to avoid coding mistakes in applications. Plus there are compiler generated calls that you need to be aware of. Hence the bloat.

        There are no applications close to the metal so I wouldn't be using C++ there.

        Comment

        • RabahMabhoul
          New Member
          • May 2015
          • 6

          #5
          Thank you for those special answers !
          if for example I want to develop softwares for windows witch language should I chose !

          Comment

          • RabahMabhoul
            New Member
            • May 2015
            • 6

            #6
            and the question that delve in my head this time what is the
            difference between assembly and c ? if they are both low level programming languages !

            1- Is assembly included in c ? or c is an advanced version of assembly ?

            2-is c programming languages do every thing that assembly language do -?

            Comment

            • weaknessforcats
              Recognized Expert Expert
              • Mar 2007
              • 9214

              #7
              What kind of software for Windows?

              If it's an application that is to run on the web you might be using C#. If it is an internal OS extension feature yu will probably need to use Microsoft's version of C - plus all their naming conventions (don't get me started).

              As to assembly language and C it's this way:

              The C compiler generates assembly code. This assembly code is converted machine language using an assembler (also a compiler). When you build a C program these two compilers are used to get your object file.

              Comment

              • donbock
                Recognized Expert Top Contributor
                • Mar 2008
                • 2427

                #8
                Another difference between C and assembly language is that it is possible (if you're careful) to write portable programs in C that can run without alteration on any computer that has a C compiler; while each processor has its own custom assembly language. Assembly language programs are not portable.

                On the other hand, portability is not much of an issue when writing a device driver -- which, by definition, is specific to a particular hardware platform. Nevertheless, it is almost always easier to move a no portable C program from one platform to another than it is to rewrite an assembly language program for a different processor.

                Engineers sometimes speak of "embedded systems" -- a product that contains a processor (a coffee pot, a router, a car, etc). C can be used for to program embedded systems, but be careful - embedded systems are typically "freestandi ng implementations ", a phrase used in the C Standard for an implementation that is permitted to provide only a small subset of the Standard C Library.

                Comment

                Working...