Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined behavior #1

Open
rgrmra opened this issue May 29, 2024 · 2 comments
Open

Undefined behavior #1

rgrmra opened this issue May 29, 2024 · 2 comments

Comments

@rgrmra
Copy link

rgrmra commented May 29, 2024

Your ft_atoi_recursive has an undefined behavior when you try to pass numbers with minus in the middle of the string, like: 1-1-1-1 or 111-1.

static long ft_atoi_recursive(const char *string, long sign, long nb)

@0bvim
Copy link
Owner

0bvim commented May 30, 2024

Your ft_atoi_recursive has an undefined behavior when you try to pass numbers with minus in the middle of the string, like: 1-1-1-1 or 111-1.

static long ft_atoi_recursive(const char *string, long sign, long nb)

I can't reproduce the error...
I tried

./philo 5 800 111-1 200
./philo 5 800 1-1-1-1 200

@rgrmra
Copy link
Author

rgrmra commented May 30, 2024

No, your program is working properly. The error is exclusive from ft_atoi_recursive. I'm just warning you that it has an undefined behavior in some cases and if you want to use it in a future program.

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

No branches or pull requests

2 participants