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 12:48:19 +0200
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]