Talk:Boolean data type

message: not (FALSE) 00000000 is (TRUE) 11111111 or -1.
Some versions of basic and pascal, treat -1 specifically as being TRUE.
Just a thought.
Duser404 (talk) 08:20, 4 November 2011 (UTC)
thread_title:  Logic and bits 

message: This page should mention something about Church Booleans. Wouter Lievens 11:26, 7 May 2005 (UTC)
thread_title:  Church Booleans 

message: The last edit was changing the "Brainfuck" references to "Brainf**k" which shouldn't be a change.  That is the name of the language so it shouldn't be censored.  Also, the anon IP didn't even correctly change the links to which "fuck" is a part of.  So I changed it back to what it should be. Chris M. 07:34, 10 January 2006 (UTC)
replies: text: Heres to that, Wikipedia does not censor. Good job--Oxinabox1 08:36, 22 June 2007 (UTC)
replies: text: ???????????????????? (What are you on about?) LOTRrules (talk) 13:49, 17 February 2008 (UTC)
replies: text: Brainfuck. 58.145.148.89 (talk) 10:49, 16 August 2010 (UTC)
thread_title:  Revert over Brainfuck 

message: I don't get the part about Ruby. First the text says Ruby doesn't have a boolean data type, but then it says it has literals true and false. What (dynamic) type are these, then? Strings? Numbers? If they're objects, what class are they? I bet it's "Boolean"... Wouter Lievens 12:30, 11 February 2006 (UTC)
thread_title:  Ruby 

message: The examples should all to the same thing.
Rather than Python going on about SPAM and EGGs, and VB talking about the end of the world or what ever.--Oxinabox1 08:39, 22 June 2007 (UTC)
replies: text: The languages don't have consistent handling of boolean values. One example for all would be inappropriate. You should allow scope for each language to show some of its usual ways of using booleans. --Paddy 17:11, 22 June 2007 (UTC)
replies: text: This point should be moot now that the examples have been moved to the respective language Talk pages. --Jorge Stolfi (talk) 00:37, 31 December 2009 (UTC)
thread_title: Consistent example

message: I removed all of the citation tags.  The adder of these tags states that "assertions about programming languages need references".  This is not inline with policy.  Policy's test is material that is challenged or likely to be challenged.  Thinking that Ada having True and False as "challengable" is very unlikely.  The author isn't challenging them to begin with, just that an assert requires a reference (which is not true in terms of policy).
As far as code being considered original research, again, is not inline with policy.  Providing simple source code about true/false comparisons is in no way, shape, or form near something like saying vitamin B12 causes AIDS.  Code for an established language that demonstrates the syntax and/or semantics of said language, by definition, cannot be original research.  Such functionality is inherit to the language.  It's like saying that a sample sentence highlighting nouns is original research.  Cburnett 01:07, 23 July 2007 (UTC)
replies: text: This point should be moot now that the examples have been moved to the respective language Talk pages. --Jorge Stolfi (talk) 00:38, 31 December 2009 (UTC)
thread_title:  Citation tags and OR 

message: Usually they name boolean variables something like "isEnabled", "hasItem", "canHandle", "shouldDelete" etc. What is the wordgroup called for the words "is", "has", "can", "should" etc.? The closest I found was Copula, but I doesn't seem to fit every case. -- 88.117.79.142 (talk) 21:48, 28 July 2008 (UTC)
thread_title: Wordgroup for boolean prefix

message: typedef enum { FALSE, TRUE } boolean;
...
boolean b;
The following typical preprocessor macros are also often used.
#define FALSE 0
#define TRUE 1
Well, the article says *ALSO* often used. However, the enum example won't work before FALSE and TRUE are #defined. Hence this is not optional, but mandatory! [edit] On gcc, you need: 
typedef enum { false, true } boolean;
Note that CAPITALIZING the "false" and "true" will result in errors! (just checked!)
-andy 92.230.16.89 (talk) 21:43, 5 November 2008 (UTC)
replies: text: The only way that should cause an error is if FALSE and TRUE were #defined or declared before the enum declaration.  For example, some #included header might do that. — DAGwyn 158.12.36.83 (talk) 23:26, 20 June 2011 (UTC)
replies: text: Pascal has almost exactly that. boolean is, eseentially typedef {false, true} bool. Pascal is better in the sense that it is undefined behaviour to try assinging any other value.
19:40, 24 February 2009 (UTC)
thread_title:  Enum example - can this work? 

message: There is also a built-in (in contrast to the bool in <stdbool.h>) boolean type called _Bool. Anyone who knows more about this?
Rndusr (talk) 08:35, 6 February 2009 (UTC)
replies: text: Actually, the bool in <stdbool.h> is a #define for _Bool. Not much more to say about it really, but I added the info to the C99 chapter. decltype 09:43, 6 February 2009 (UTC)
replies: text: Bool is a proper first-class datatype now (though implicitly converted to int). I don't have the refs with me, they are at work
SimonTrew (talk) 19:38, 24 February 2009 (UTC)
replies: text: _Bool (not Bool) is a standard (unsigned) integer type in C99, distinct from other types, specified to have a width of at least 1 bit.  It is intended to be used only via bool from <stdbool.h>.  Conversion to and from type _Bool involve the value of the lowest bit in the representation of _Bool, e.g. converting from type long produces 1 if the operand was nonzero and 0 if the operand was zero.  Relational expressions still have type int. — DAGwyn 158.12.36.83 (talk) 23:34, 20 June 2011 (UTC)
thread_title:  What about _Bool in C99? 

message: This is probably an old chestnut but should it be Boolean or boolean? I don't mind either but it is inconsistent through the article.
SimonTrew (talk) 19:37, 24 February 2009 (UTC)
replies: text: The abstract data type (not specific to any programming language) should be "a Boolean data type" since that is merely the English word. The name of the data type in specific languages may be Boolean, boolean, BOOLEAN, bool, _Bool, LOGICAL, bool_t, ... and case may or may not matter.  All the best,--Jorge Stolfi (talk) 00:44, 31 December 2009 (UTC)
thread_title:  Caps 

message: It is true that the boolean operators ==, !=, >=, <= all return either 1 or 0. But the macros (or enum values) TRUE and FALSE are entirely implementation-dependent, and need not be defined at all. Assuming that the rules for language extensions are similar to those of C++, a program such as
int main(void)
{
  return (1 == TRUE);    
}
should not compile without a diagnostic message, because TRUE is undefined, or defined as a compiler extension. Either way, the return value of the resulting program is not mandated by the standard. decltype (talk) 02:18, 19 April 2009 (UTC)
replies: text: The relevant part in the text seems to talk about user-defined (not implementation-defined) constants "TRUE" and "FALSE", for example, those defined by "enum { FALSE, TRUE }" or a "#define TRUE 1". In both cases, TRUE will be equal to 1 and, e.g., "(a != b) == TRUE" should work as expected; there is nothing implementation-defined here. I can see the point the text is trying to make, but as it stands, I find it misleading. — Miym (talk) 09:39, 19 April 2009 (UTC)
replies: text:  Good point. I have tried to tweak the text a little. I would provide a cite that comparing against TRUE/FALSE is discouraged in C, but I couldn't find one. decltype (talk) 15:32, 19 April 2009 (UTC)
thread_title:  fact tag in C regarding FALSE and TRUE 

message: There used to be an "Algol 68" section with the following contents:
:An actual extract from the ALGOL 68 language specification (page 177) where the Boolean operators are defined:
:10.2.2. Operations on Boolean Operands
::*op ∨ = (bool a, b) bool:( a | true | b );
::*op ∧ = (bool a, b) bool: ( a | b | false );
::*op ¬ = (bool a) bool: ( a | false | true );
::*op = = (bool a, b) bool:( a∧b ) ∨ ( ¬b∧¬a );
::*op ≠ = (bool a, b) bool: ¬(a=b);
::*op abs = (bool a)int: ( a | 1 | 0 );
Methinks that the above quote  from the Algol 68 manual is too cryptic and of little value to the reader; so I have reduced that section to a short mention that Algol 68 had a bool data type pretty much like Algol 60's Boolean.  OK? --Jorge Stolfi (talk) 01:13, 21 June 2009 (UTC)
thread_title:  Boolean types in Algol 68 

message: This example was removed from the History section:
:For example,
:
(cond
  ((eq x y) (func1 ...))
  (x (func2 ...))
  (t (func3 ...)))
:could be written in C-like syntax
:
if (x == y) { func1 ...; }
else if (x != nil) { func2 ...; }
else { func3 ...; }
It is here in case it may be useful somewhere, someday. --Jorge Stolfi (talk) 22:37, 21 June 2009 (UTC)
thread_title:  Removed LISP example 

message: I am not sure about how Lua fits in the taxonomy given in the "History" section, so I left it out for now. Here is part of what the article said about it:
:Lua as of version 5.0. defines a boolean type which can be either true or false.  The special value nil (of type nil) also evaluates to false in logical expressions. The logical operators and and or return one of their arguments as the result instead of the value true or false.
Help will be appreciated. --Jorge Stolfi (talk) 05:56, 31 December 2009 (UTC)
thread_title:  Classification of  Lua 

message: There are a couple issues with this part:
# The first sentence seems to imply that AWK and Perl have a separate Boolean data type, whereas they do not.
# While C++ predates Perl, it postdates AWK.
I suggest simply dropping the second sentence.  — Preceding unsigned comment added by Nathanweeks (talk • contribs) 02:20, 12 September 2012 (UTC)
thread_title:  Perl and AWK