Re: Booleans, what a wonderful type!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 18, 2007 at 03:43:39AM +0200, ricknu-0@xxxxxxxxxxxxxx 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++?
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux