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

Multiple Instruction when casting in both side at the assignment #510

Open
MoulatiMehdi opened this issue Sep 2, 2024 · 0 comments
Open

Comments

@MoulatiMehdi
Copy link

Describe the bug
when casting in both side of the = at the assignement is considered as multiple instructions

Erroneous code

#include "ft_utils.h"

void	*ft_realloc(void *mem, int size)
{
	void	*new_mem;
	int		i;

	i = 0;
	new_mem = malloc(size);
	if (!new_mem)
		return (0);
	if (mem)
		while (i < size)
		{
			((char *)new_mem)[i] = ((char *)mem)[i]; // <-- Here
		 	i++;
		}
	free(mem);
	return (new_mem);
}

Additional infos
version : norminette 3.3.55

Additional context

ft_realloc.c: Error!
Error: MULT_IN_SINGLE_INSTR (line:  26, col:   1):      Multiple instructions in single line control structure
@MoulatiMehdi MoulatiMehdi changed the title Multiple Instruction when casting and assignment Multiple Instruction when casting in both side at the assignment Sep 2, 2024
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

1 participant