Skip to content

Conversation

vil02
Copy link
Member

@vil02 vil02 commented Sep 25, 2025

Description of Change

The previous version of the code did not handle properly the incorrect inputs potentially leasing to segmentation faults. This change updates the code to handle all possible cases, i.e.:

  • when there are not enough operands to pop from the stack (during the computation and at the end of it),
  • when there are elements left on the stack after fishing the computation.

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:
Handle incorrect inputs in `postfix_evaluation`.

@vil02 vil02 marked this pull request as ready for review September 25, 2025 17:43
@realstealthninja realstealthninja merged commit e72b7aa into TheAlgorithms:master Sep 26, 2025
6 of 7 checks passed
@vil02 vil02 deleted the handle_wrong_inputs_in_postfix_evaluation branch September 26, 2025 13:27
realstealthninja pushed a commit to realstealthninja/C-Plus-Plus that referenced this pull request Oct 1, 2025
realstealthninja added a commit to realstealthninja/C-Plus-Plus that referenced this pull request Oct 1, 2025
realstealthninja added a commit to realstealthninja/C-Plus-Plus that referenced this pull request Oct 1, 2025
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.

2 participants