Page 1 of 1

C++ programming with ESP32 Lyrat

Posted: Sat Feb 01, 2020 1:36 pm
by ottaviane
Hello,
is there anyone who programs in c++ with Lyrat? Why examples in ADF sdk are in C?
Thanks all.
Bye

Re: C++ programming with ESP32 Lyrat

Posted: Sat Feb 01, 2020 6:51 pm
by shabtronic
Why C over C++?

C is traditionally used in embedded because of it lightweight nature. C++ can be rather heavy on memory usage esp with STl.

With C you can control where your memory is allocated - dram or spi ram - very easily with the esp malloc. With C++ and STL it's rather complicated to write a custom allocator to control dram/spi ram allocation.

I use C++ it's great with STL - but you have to do alot of work not to use up all the dram.

Re: C++ programming with ESP32 Lyrat

Posted: Sun Feb 02, 2020 8:01 am
by ottaviane
ok thank you for your replay.
I like c++ and it is very useful in more complicated project.
But in this case, lyrat, I need to be not expansive with resources. :lol:
thank you.

Re: C++ programming with ESP32 Lyrat

Posted: Mon Feb 03, 2020 9:53 am
by ESP_Sprite
Note that C and C++ are mostly interoperable, and ESP-IDF (the SDK ESP-ADF is built on top of) supports the base C++ language as well. You should be able to write additions for ADF in C++ if you so desire, even if we don't have explicit examples of it.

Re: C++ programming with ESP32 Lyrat

Posted: Wed Feb 05, 2020 4:47 pm
by ottaviane
ESP_Sprite wrote:
Mon Feb 03, 2020 9:53 am
Note that C and C++ are mostly interoperable, and ESP-IDF (the SDK ESP-ADF is built on top of) supports the base C++ language as well. You should be able to write additions for ADF in C++ if you so desire, even if we don't have explicit examples of it.
thank you, for me it is very encouraging.