new and delete keywords PROS

I’ve recently transitioned to PROS from RobotC, and I’m attempting to make our robot code with a fully object oriented design. I am currently just developing code and checking if it compiles, but I can’t do any runtime tests for a few weeks until my team starts meeting up again for the ITZ season. Obviously, that’s not the ideal way to test new code, but for now its my only option.

Recently, I stumbled across this [very old] thread https://vexforum.com/t/purdue-robotics-os-pros-now-available/24257/1 where @Jabibi mentioned that PROS may not fully support the new and delete keywords. This does present a problem for my code, which uses new for a pointer object construction. And where there is new, you’ll probably eventually need delete. However, my code does actually compile with new/delete without any issue. Has this been added to PROS in a newer version, or will it still be a problem at runtime? If it will be a problem, how should I deal with this?

The code can be found here if anyone is interested: https://github.com/niwhsa9/VEX_2017-2018_Team2496V_CODE
Also, if anyone who is knowledgeable about PROS/C++ is feeling especially generous, would you please look over the code quickly and let me know if you see any major problems with the basic structure and use of C++ like this on an embedded system.

Thanks! I appreciate any help.

Check out this blog post for a guide on using C++ properly with PROS (when I say “properly,” I mean with real support for objects, etc.).

There is a part of the post where it talks about a symbol conflict between PROS and newlib regarding


FILE

, but this will be fixed in the next release of the kernel.

PROS can compile C++ files without modification, but you will have to make some changes in order to use all the features of the C++ standard library.

Here is an example of a project that uses C++ with PROS.

Edit:
As of February 2014, the


new

and


delete

operators were added as wrappers around calls to


malloc

and


free

, respectively. That means those operators will work, but you will still need to make some changes in order to use other features of C++.

1 Like

@hotel thanks: speedy response, answered my question perfectly!