Skip to content

Conversation

@Kronos3
Copy link
Collaborator

@Kronos3 Kronos3 commented Jun 5, 2025

This code cleans up the toString() on structs which as a side benefit reduces the stack memory required to format the struct into a string (Closes #722).

Before
Format each individual member into it's own string on the stack and then use a big old Fw::String.format() call with a predefined format string to glob all the members into a single string.

Now
Move through each member in the string and append the formatted member to the string. There is optionally a single Fw::String tmp which members will use to format into if needed before appending to the output.

  • Test with FppTest
  • Test with check-cpp

@Kronos3 Kronos3 requested a review from bocchino June 5, 2025 23:28
Copy link
Collaborator

@bocchino bocchino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! The new code gen strategy is much better.

I confirmed that the fpp-check tests pass and the FppTest tests pass in nasa/fprime/devel.

@bocchino bocchino merged commit c1a7b7e into main Jun 6, 2025
14 checks passed
@bocchino bocchino deleted the tumbar-struct-to-string branch June 6, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

toString() for structs uses too much stack space

3 participants