Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Aug 2001 16:31:36 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Mark Murray <mark@grondar.za>
Cc:        <arch@FreeBSD.ORG>
Subject:   Re: Style 9 nitpicking question 
Message-ID:  <20010817162340.O34503-100000@besplex.bde.org>
In-Reply-To: <200108161551.f7GFpLK72129@grimreaper.grondar.za>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 16 Aug 2001, Mark Murray wrote:

> > > Questions:
> > >
> > > 1) That "(void)" is useless by any metric that I am able to determine
> > >    (WARNS=2, BDECFLAGS etc), and gets in the way of linting. Is there
> > >    any reason to continue to advocate its use by this example? There
> > >    is no other reference to "voiding-out" of return values.
> >
> > It by prevents warnings like the following from `lint -h':
> >
> >     "snprintf returns a value which is sometimes ignored"
> >     "snprintf returns a value which is always ignored"
>
> Hmm - in the linting that I have done, I've told lint that ignoring
> the return value of ${THESE} functions is OK.
>
> (THESE = str* *printf, *scanf and a few others)

Ignoring the result of *printf is not always OK, and ignoring the result of
*scanf is almost never OK.

> > This is the opposite of getting in the way of linting.
>
> Sorta :-) Its often not a useful warning (most particularly for
> certain functions), and the (void) cast offends me because it is
> useless and obfuscating.

I don't like it much either, but it's normal practice in BSD code.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010817162340.O34503-100000>