C++ programming with ESP32 Lyrat

ottaviane
Posts: 5
Joined: Sat Jan 11, 2020 1:41 pm

C++ programming with ESP32 Lyrat

Postby ottaviane » Sat Feb 01, 2020 1:36 pm

Hello,
is there anyone who programs in c++ with Lyrat? Why examples in ADF sdk are in C?
Thanks all.
Bye

User avatar
shabtronic
Posts: 49
Joined: Sun Nov 03, 2019 1:33 pm

Re: C++ programming with ESP32 Lyrat

Postby shabtronic » Sat Feb 01, 2020 6:51 pm

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.

ottaviane
Posts: 5
Joined: Sat Jan 11, 2020 1:41 pm

Re: C++ programming with ESP32 Lyrat

Postby ottaviane » Sun Feb 02, 2020 8:01 am

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.

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: C++ programming with ESP32 Lyrat

Postby ESP_Sprite » 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.

ottaviane
Posts: 5
Joined: Sat Jan 11, 2020 1:41 pm

Re: C++ programming with ESP32 Lyrat

Postby ottaviane » Wed Feb 05, 2020 4:47 pm

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.

Who is online

Users browsing this forum: No registered users and 62 guests