Re: code style in the vfs
- From: Leonard den Ottolander <leonard den ottolander nl>
- To: MC Devel <mc-devel gnome org>
- Subject: Re: code style in the vfs
- Date: Sun, 26 Sep 2004 13:26:17 +0200
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]