Re: code style in the vfs



Hello Oswald,

On Sun, 2004-09-26 at 13:09, Oswald Buddenhagen wrote:
> right, but it's the wrong place. change the return value to const char *
> and no compiler will warn about the bug.
> we want a warning at *slash = 0;

Explicitly casting the return type to char * would be a grave
programming mistake, and the coder would violate his own rules.

Even in the example below you will get a warning. Explicitly casting
path2 to char * is about as silly as the above.

char *dirname (const char *path)
{
     char *path2 = path;
     char *slash = strrchr (path2, '/');
     if (slash)
         *slash = '\0';
     return path2;
}

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]