Thread (5 messages) 5 messages, 3 authors, 2015-01-08

ternary vs double exclamation

From: Greg KH <hidden>
Date: 2015-01-05 00:50:58

Possibly related (same subject, not in this thread)

On Sun, Jan 04, 2015 at 06:43:22PM -0500, John de la Garza wrote:
On Sat, Jan 03, 2015 at 11:20:29PM -0500, Valdis.Kletnieks at vt.edu wrote:
quoted
On Sat, 03 Jan 2015 18:54:00 -0500, John de la Garza said:
quoted
It should not be assumed that true will always be 1 as defined in
include/linux/stddef.h, right?
No, I mean use an actual 'bool' type rather than 'int'.  Consider this from
kernel/softirq.c:
yes, bool has two possible values true and false

from include/linux/stddef.h:
enum {
	        false   = 0,
		true	= 1
};


I assume it is a bad idea to depend on true being 1, right?  I mean, I
should assume that true could be changed to any non 0 value in the future,
right?
Why would that matter?  Just always test for "true" and "false" and you
will be fine.

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help