[Verse-dev] profiling the server

Emil Brink emil at obsession.se
Fri Oct 15 12:57:54 CEST 2004


[all-bits-zero for floating point numbers] 
> Ok. My C book told me otherwise, but after some googling it seems like this
> is really a theoretical problem.

Yeah, C itself doesn't guarantee it, but if you know the machine uses IEEE754
floats (which is more or less a requirement for Verse anyway; there is no
translation code, all machines are silently assumed to use IEEE floats) the
problem goes away as Thorsten pointed out.

Not sure about strcpy() though, a buffer-limiting copy is probably good,
I prefer using something like this over C's strncpy():

char * stu_strncpy(char *dest, size_t max, const char *src)
{
	char	*base = dest;
	
	if(dest == NULL || src == NULL)
		return NULL;
	if(max == 0)
		return NULL;
	for(max--; max > 0 && *src != '\0'; max--)
		*dest++ = *src++;
	*dest = '\0';

	return base;
}

Since the standard strncpy() is so... Weird, heh.

/Emil


More information about the Verse-dev mailing list