code style in the vfs
Leonard den Ottolander
leonard at den.ottolander.nl
Sun Sep 26 10:48:19 UTC 2004
Hello Pavel,
On Sun, 2004-09-26 at 10:30, Pavel Tsekov wrote:
> > char *dirname (const char *path)
> > {
> > char *slash = strrchr (path, '/');
> > if (slash)
> > *slash = '\0';
> > return path;
> > }
> >
> > No compiler could ever warn you about this "const-away" cast, and if you
> > pass a string literal to it, the behaviour is undefined.
>
> I know that the compiler won't detect it.
Actually it does (for this particular piece of code). Without a cast on
the return value that code *does* produce a warning (return discards
qualifiers from pointer target type).
Leonard.
--
mount -t life -o ro /dev/dna /genetic/research
More information about the mc-devel
mailing list