From: Al Viro <viro@ftp.linux.org.uk>
To: ricknu-0@student.ltu.se
Cc: linux-sparse@vger.kernel.org
Subject: Re: Booleans, what a wonderful type!
Date: Wed, 18 Jul 2007 03:19:08 +0100 [thread overview]
Message-ID: <20070718021907.GS21668@ftp.linux.org.uk> (raw)
In-Reply-To: <1184723019.469d704b6111b@portal.student.luth.se>
On Wed, Jul 18, 2007 at 03:43:39AM +0200, ricknu-0@student.ltu.se wrote:
> * Most likly a _really_ stupid newbie question, but I have seen several of this
> form:
> <function>
> {
> <variable> a;
> <doing something useful (no sign of 'a')>
> a = <some value/variable>;
> <exit>
> }
> How is this variable useful?
Explain, please. If you mean moving the declaration down - it's not
idiomatic in C and frankly, C++ style tends to make declarations harder
to find when you read the code.
> * Why is there no va_end() after va_start()?
Where?
> According to the manual (STDARG(3)):
> va_end
> Each invocation of va_start() must be matched by a corresponding invo-
> cation of va_end() in the same function. After the call va_end(ap) the
> variable ap is undefined. Multiple transversals of the list, each
> bracketed by va_start() and va_end() are possible. va_end() may be a
> macro or a function.
Yes, and AFAICS uses of va_start()/va_end() in sparse are correct. If you
see any broken one - yell.
> * Is there any advantage of "for (;;)" instead of ex "while (true)"?
It's more idiomatic and faster recognized by readers. while (1) is also
quite common; while (true) will be understood, but will distract since it
will take more conscious effort to recognize.
> * Why is it written in C and not C++. Easier access to kernel-developers? (just
> curious)
Generally saner language? Turn the question around - what in sparse would
be inherently cleaner in C++?
next prev parent reply other threads:[~2007-07-18 2:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-18 1:43 Booleans, what a wonderful type! ricknu-0
2007-07-18 2:19 ` Al Viro [this message]
2007-07-18 2:40 ` Brett Nash
2007-07-18 16:33 ` Josh Triplett
2007-07-19 0:23 ` ricknu-0
2007-07-18 2:25 ` Al Viro
2007-07-19 0:38 ` ricknu-0
2007-07-19 7:30 ` Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070718021907.GS21668@ftp.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=linux-sparse@vger.kernel.org \
--cc=ricknu-0@student.ltu.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.