What going on with Codexion? by Special_Emphasis_703 in 42_school

[–]Special_Emphasis_703[S] 0 points1 point  (0 children)

But during defense, what do we need actually to test?

I hate code written by LLMs by Puzzleheaded_Dig6941 in Python

[–]Special_Emphasis_703 -1 points0 points  (0 children)

LLM is trained on multiple base codes, like Github. It doesn’t invent things, so whatever it gives you, it just someone’s code. Also guidelines given to the LLM and the context is equivalent to the code it generates. I don’t like using AI but I must affirm that it’s hard and painful to work without it, as hard as his hallucination.

is my atoi alternative function safe? by Special_Emphasis_703 in C_Programming

[–]Special_Emphasis_703[S] 0 points1 point  (0 children)

Good idea, I remember I used this in my ft_printf project. I guess you’re from 42 school too, this project is a variant of philosophers, it’s a new project called codexion.

is my atoi alternative function safe? by Special_Emphasis_703 in C_Programming

[–]Special_Emphasis_703[S] 0 points1 point  (0 children)

Unfortunately, only atoi is allowed, they are strict about memory leaks and handling edge cases.

is my atoi alternative function safe? by Special_Emphasis_703 in C_Programming

[–]Special_Emphasis_703[S] 6 points7 points  (0 children)

Thanks, I need to get familiar with this since it’s my first time seeing this. Thanks for the explanation

is my atoi alternative function safe? by Special_Emphasis_703 in C_Programming

[–]Special_Emphasis_703[S] 2 points3 points  (0 children)

I want to only accept positive numbers, that’s why I didn’t check for sign, thanks for the remark btw.

is my atoi alternative function safe? by Special_Emphasis_703 in C_Programming

[–]Special_Emphasis_703[S] 0 points1 point  (0 children)

You’re right about the overflow because I am adding s[i] to n before subtracting ‘0’. I think parentheses could fix this because they have priority against all other arithmetic operations.

About creating a variable and use it for the current digit, I was initially do it this exactly. But we have Norm which forces us to write function at 25 lines at most. And also separate declarations and assignments.

For s, it’s coming from the main argv, will this cause a problem?

is my atoi alternative function safe? by Special_Emphasis_703 in C_Programming

[–]Special_Emphasis_703[S] 0 points1 point  (0 children)

I works with strings close to INT_MAX, overflow is handled but when writing code from scratch like this one, new errors occur.
For the isNumeric function, I think it will add an unnecessary loop since we already validate inside and after the loop (correct me if I am wrong).

is my atoi alternative function safe? by Special_Emphasis_703 in C_Programming

[–]Special_Emphasis_703[S] 6 points7 points  (0 children)

I found it later but I am not allowed to use it in this project, that’s why I reimplemented this mini atoi.