Ask Your Question
4

Why is it that when I execute the myInt class on Clion, there are no errors, but when I try to do the same on g++, I get segmentation errors only when I input digits that exceed a value of 10?

asked 2023-06-23 14:59:53 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-06-23 15:07:01 +0000

ladyg gravatar image

It is possible that Clion is using a different version of the C++ compiler than g++. Clion may be using a newer version that has better error handling and is more forgiving of mistakes in the code.

Additionally, the segmentation errors you are seeing may be due to a memory issue. When you exceed a value of 10, the program may be trying to access memory that has not been allocated or has already been freed. This could be due to a memory leak in the code or an issue with how the memory is being managed.

To diagnose the issue, you can use a debugger to step through the code and see where the program is crashing. This can help you identify the specific issue and make the necessary changes to fix it.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-23 14:59:53 +0000

Seen: 9 times

Last updated: Jun 23 '23