This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Could i use c++ instead of c?

Hi,

i have a generell question. First i have to say i am not the best programmer, but maybe some one with more experience then me could help me.

Does it make sense to use the C examples and port them in to C++ classes and use C++ instead of C?

What would be the disadvantage of using C++ ? Is some one using C++? I thought i could use eclipse + gcc so i could use c++.

Best regards,

Nils

Parents
  • Hi Nils,

    I'm using C++ for decades now and I can't see why C++ wouldn't make sense to embedded software development. Not just for the OO support build into the language but especially for the new features coming with C++11 (Here a link to a talk from Rainer Grimm on the last years meetingcpp). SW development is about communicating a solution to a problem. And this solution must be readable not only to the compiler but to our selfs reading the software years later and to our colleagues. I think C++ provides better means to address this compared to C. And C++ can be easily be used with C if you want to use SW written in C.

    You must be aware, that there are some features like exceptions and runtime type informations that you most likely don't need but increase the code size a lot. But this features can be disabled in most compilers.

    Eclipse + CDT is for sure a good IDE but especially for embedded projects, I would go for a command line build using very common standard tools (make/cmake + gcc for example) and then adding an IDE on top of this. This gives you the guaranty, that you can build (and thus change) the software even in 10 years without the need to keep an old computer with the old OS where the old IDE is running on.

    best regards,

    Torsten

Reply
  • Hi Nils,

    I'm using C++ for decades now and I can't see why C++ wouldn't make sense to embedded software development. Not just for the OO support build into the language but especially for the new features coming with C++11 (Here a link to a talk from Rainer Grimm on the last years meetingcpp). SW development is about communicating a solution to a problem. And this solution must be readable not only to the compiler but to our selfs reading the software years later and to our colleagues. I think C++ provides better means to address this compared to C. And C++ can be easily be used with C if you want to use SW written in C.

    You must be aware, that there are some features like exceptions and runtime type informations that you most likely don't need but increase the code size a lot. But this features can be disabled in most compilers.

    Eclipse + CDT is for sure a good IDE but especially for embedded projects, I would go for a command line build using very common standard tools (make/cmake + gcc for example) and then adding an IDE on top of this. This gives you the guaranty, that you can build (and thus change) the software even in 10 years without the need to keep an old computer with the old OS where the old IDE is running on.

    best regards,

    Torsten

Children
No Data
Related