Hi, I'm getting a warning when compiling the following code:

void printstr(unsigned char *string, volatile unsigned char *videoram) // Print a string
{
	int i = 0;
	while(string[i] != '\0')
	{
		videoram[2*i] = string[i]; 
		videoram[1+(2*i)] = 0x07;
		i++;
	}
}

unsigned char *memset(unsigned char *dest, unsigned char val, int count) // Set bytes of destination string to value
{
	int i;
	for(i = 0; i < count; i++)
		*dest++ = val;
	return dest;
}

void kmain( void* mbd, unsigned int magic )
{
	//gdt_install()
	volatile unsigned char* videoram = (volatile unsigned char *) 0xb8000;
		
	unsigned char string[] = "Hi";
	memset(string, 'H', 2);

	clear(videoram);
	printstr(string, videoram);
}

The warnings are:

Source Files/kernel.c:12: warning: conflicting types for built-in function ‘memset’
Source Files/kernel.c:29: warning: pointer targets in passing argument 1 of ‘printstr’ differ in signedness

The code compiles fine, I was just wondering why I get the warnings. I checked the types and they seem fine. I'm using GCC on linux.

Rename your memset function so it doesn't have the same name as the library function.

I don't know about the problem with printstr.

Rename your memset function so it doesn't have the same name as the library function.

I don't know about the problem with printstr.

It worked, but I don't know why it was happening... I didn't include string.h, so the only memset function it should have seen was the one I wrote, right?

what includes are you using? maybe one of them also includes string.h

what includes are you using? maybe one of them also includes string.h

I'm not using any includes other than headers that I write.

Your compiler probably just warns you because it is not a good idea in general to name a function the same as one in the standard library.