esp-idf/tools/test_apps/system/cxx_no_except/main/main.cpp
Jakob Hasse 2552c7ba0f [C++]: wrapper functions around unwind code
* Replaced all C++ exception related
  functions with wrappers if -fno-exception
  is used. This prevents linking of the
  corresponding code in libgcc. The code
  size will decrease by around 7-9 KB when
  building with -fno-exception.
* added no except test app

Closes https://github.com/espressif/esp-idf/pull/5380
Closes https://github.com/espressif/esp-idf/issues/5363
Closes https://github.com/espressif/esp-idf/issues/5224
Closes IDFGH-3153
Closes IDF-2577
2021-04-20 14:27:58 +08:00

28 lines
652 B
C++

/*
No except example.
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include "esp_system.h"
#include <new>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
extern "C" void app_main()
{
char *char_array = new (std::nothrow) char [47];
for (int i = 10; i >= 0; i--) {
char_array[i] = i;
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
esp_restart();
delete [] char_array;
}