snikeguo commented on issue #16775:
URL: https://github.com/apache/nuttx/issues/16775#issuecomment-3122060215

   I have also encountered this problem.
   
   If you want to use the C++ provided by the toolchain, you must compile the 
C++ library of GCC, i.e., libstdc++-v3, by yourself.
   I have successfully compiled LLVM's LIBC++ 17.0.6, but it is hardly usable 
because it occupies a very large stack space. For example:
   ```
   std::vector<u8> tv1;
   printf(tv1);
   tv1.push_back(1);
   ```
   The above code will use nearly 1 - 2KB of stack space. In fact, when I print 
the size of tv1, tv1 only occupies dozens of bytes. I tried to decompile the 
code, as shown in the figure. So LLVM's LIBC is also not available.
   
   <img width="2175" height="1196" alt="Image" 
src="https://github.com/user-attachments/assets/47276327-9b95-49eb-bb19-bc35207206c9";
 />
   
   <img width="826" height="580" alt="Image" 
src="https://github.com/user-attachments/assets/32dcc5c8-f2f8-4fb1-99eb-f35fb53178ea";
 />
   
   You can use uclibc++. The above code works fine in uclibc++ and only 
occupies a very small stack space.
   
   <img width="2443" height="897" alt="Image" 
src="https://github.com/user-attachments/assets/db021257-8aad-4257-9660-d02e679c4d1d";
 />
   
   In conclusion, using C++ is not a very good choice for the time being. 
Therefore, I have removed the STL from my project entirely.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to