Author Topic: c vs cpp for stm32  (Read 7027 times)

0 Members and 1 Guest are viewing this topic.

Offline cv007

  • Frequent Contributor
  • **
  • Posts: 487
Re: c vs cpp for stm32
« Reply #100 on: January 19, 2019, 05:23:12 pm »
Quote
the following piece of pseudo-C-code

Quote
is_approved
False
isNotEqualTo
True
is_ok
that's a lot of true/false stuff going on in there, probably not FAA approved.

Since pseudo code doesn't need to pass any tests, I'm sure you could do your pseudo code to c++ (at least in this forum)-
Code: [Select]
Project myproject;
while( not myproject.committed() ){ myproject.start_over() }

we don't need to know what's in the Project process, and if we do you can show us the Project class.

:)
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: c vs cpp for stm32
« Reply #101 on: January 19, 2019, 07:45:43 pm »
LOL  you made the trick, I do like it  ;D
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: c vs cpp for stm32
« Reply #102 on: January 19, 2019, 07:57:15 pm »
OOTiA is still the C++ challenge

I have *zero* direct experience with space defense, but I know by having read a fifteen years ago paper where there was the name of the U.S. Federal Aviation Administration enlisting the National Aeronautics and Space Administration's support for a project called "Object-Oriented Technology" in Aviation, which went beyond just C++ issues.

So they tried, and the project is where to look for identifying concerns about OOT relevant to safety and certification and object-oriented usage in safety-critical applications.

It's kind of *guidance bible* to certification representatives who are approving object-oriented applications to DO-178B objectives.


Fifteen years later ... we still have to be synched to the guidance. But don't panic, sooner or later ...  :palm:
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3125
  • Country: us
Re: c vs cpp for stm32
« Reply #103 on: January 21, 2019, 07:22:02 am »
Quote
Quote
weird for somebody who didn't know about std::array, to compare it with the more advanced std::vector
yes, well...  I'm very much an ASM or C programmer trying to learn new things.
huh.   I also see that std::array apparently wasn't added until C++11.  ("Really?  Are they kidding?!")
« Last Edit: January 28, 2019, 05:45:16 am by westfw »
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: c vs cpp for stm32
« Reply #104 on: January 21, 2019, 09:30:58 am »
Then you have unit tests for single-stepping through code, static_assert to prevent cross-compilation regressions, and inline assertions for run-time debugging (in unit-tests and potentially on the device) plus providing hints for static checkers (although most formal checking tools need loads more info to work by any stretch of the imagination - and you'd be damned if you use any kind of loop).

let's talk about tools, static checkers, checking tools, et al: which tool do you use?
 

Online bogdant

  • Contributor
  • Posts: 26
  • Country: ro
Re: c vs cpp for stm32
« Reply #105 on: January 21, 2019, 12:54:42 pm »
So far seems to be a faith between microcontroller world and PC world. A project will work if developers knows the language used C or C++. The C++ is used in the PC applications but C is most like in OS side. We should use some of experience from PC and apply in the microcontroller since the are more more powerfull, and have more common projects external RAM and SD card attached. Is it possible?

In the automotive also is used a subset of C99, constraind by MISRA rules. Should this be changed? It feels like I am 20 yeas into the past when I do programming at work.  I am still wandering if I should start my home project stm32 based, in C++.
Did someone face this challenge to transform one project that is already existing in C to C++?
 

Offline cv007

  • Frequent Contributor
  • **
  • Posts: 487
Re: c vs cpp for stm32
« Reply #106 on: January 21, 2019, 02:40:22 pm »
Quote
I am still wandering if I should start my home project stm32 based, in C++
You can wonder for a long time, but until you try it you will not know.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 1900
  • Country: ca
Re: c vs cpp for stm32
« Reply #107 on: January 21, 2019, 03:18:33 pm »
I am still wandering if I should start my home project stm32 based, in C++.

I would definitely try it. That's the only way to see for yourself. I would re-write it (rather than porting) trying to utilize as much of new features as I can. It'll give you a better feel of what C++ is.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf