bool

ToggleButton binding

Hi, If i have a Collection bound to n togglebuttons in a stackpanel in a usercontrol....how can I update the underlying Collection with no code behind (including Checked and unchecked events) and complete update logic? Thanks, U. ...

default constructor value for bool type

Hi alltogether, I am just wondering, which value the default constructor of bool type returns in C++. For instance writing such a code int i = int(); guarantees that the variable i will be initiated always with 0. I guess such an initialization routine is possible as well bool b = bool(); But unfortunately I could not find anywh...

Cocoa -- toggling a BOOL without repeating its name.

If a BOOL has a nice short name, it's easy enough to write: myBOOL = !myBOOL; But what if the BOOL has a long name? objectWithLongishName.memberWithLongishName.submember.myBOOL = !(objectWithLongishName.memberWithLongishName.submember.myBOOL); . . . does not look so pretty. I'm wondering if there is an easy way to toggle the BOO...

What is the binary representation of a boolean value in c#

I know that a boolean value is 1 byte (8 bits long) But I would like to know is what is its binary representation. e.g. decimal => binary 4 => 100 (0000 0100) 8 => 1000 (0000 1000) bool value => ??? ...

C# 2.0 double handling - Bizarre behaviour

Double dblValue = 0.0001; Boolean a = (dblValue >= (1 / 1000)); Boolean b = (dblValue >= 0.001); Console.WriteLine("dblValue >= (1 / 1000) is " + a); Console.WriteLine("dblValue >= 0.001 is " + b); Console.ReadLine(); The above C# code evaluates 'a' to true and 'b' to false. In VB.NET, the equivalent code evaluates 'a' to false and 'b'...

How to deal with booleans in NSMutableArrays ?

Can someone tell me why my application crashes here ? and why it does not crash when i replace the YES objects with NSString values ? all i want to do is to store boolean data into array and to modify these data later, can someone please tell me how to do this ? - (void)viewDidLoad { [super viewDidLoad]; NSMutableArray* arr = ...

NSPredicate - filtering values based on a BOOLEAN stored value

I have a core data model object called Entry. In this I have an attribute IsFavorite. I would like to use an NSPredicate to filter the results of my NSFetchedResultsController. Currently I am getting EXC_BAD_ACCESS when the fetch executes. NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; // Edit the entity name as appropr...

bool operator ++ and --

Today while writing some Visual C++ code I have come across something which has surprised me. It seems C++ supports ++ (increment) for bool, but not -- (decrement). It this just a random decision, of there is some reason behind this? This compiles: static HMODULE hMod = NULL; static bool once = false; if (!once++) hMod = Load...

_Bool and bool: How do I solve the problem of a C library that uses _Bool?

I've written a collection of data structures and functions in C, some of which use the _Bool data type. When I began, the project was going to be pure C. Now I am investigating using a C++ based GUI tool kit and have made the backend code into a library. However, when compiling the C++ GUI the following error is emitted by the compiler:...

What is the size of a Nullable<Int32>?

So, a couple of questions, actually: An int (Int32) is specified to be (obviously) 32 bits. What about an int? (Nullable<int>)? My gut tells me that it would be 32 bits for the integer plus 8 more bits for the boolean, but perhaps the implementation is more intricate than that. I would have answered my own question using sizeof(int?); ...

Is this Boolean comparison correct?

I have a managedObject with an attribute that is a Boolean. I need to compare the value of this and then hide a button if required. There's a couple of caveats, firstly the isBookmarkHidden boolean can be set and will override the property of the managedObject so the button is hidden regardless. If this boolean is NO it will then use th...

Updating nullable boolean fields in the Entity Framework

Changes to nullable bool properties are not saved back to the db in EF4 however other fields which are nullable are updating without any issues. For example, if I execute simple query similar to the following: EmployeeSurvey employeeSurvey = context.EmployeeSurveys.SingleOrDefault(s => s.EmployeeSurveyID == 60); employeeSurvey.Employee...

Does boolean.ToString() behave differently between .NET 2.0 & .NET 3.5

I've inherited a piece of code at work and I've just noticed a fairly trivial but bizarre little quirk with it. So maybe someone can save me setting up clean .NET 2.0 Environment to test it out. There is a SQL2K5 table containing a column called IsEnabled BIT NOT NULL There is a sproc selecting from that table There is a piece of C# c...

NSArray and bool values

Can an NSArray hold an array of bool values? The following code runs BOOL b = NO; NSMutableArray *array = [[NSMutableArray alloc] init]; [array addObject:[NSNumber numberWithBool:b]]; NSLog(@"value is %d", [array objectAtIndex:0] ); However, I don't get a value of 0 for NO as expected. Instead, this is what I get value is 3773...

@property problem - Objective C

Hello, I'm having a problem with properties. First, I define it: @property (readwrite) BOOL isPerformingOperation; then synthesize it: @synthesize isPerformingOperation; Then I am setting the property as such: self.isPerformingOperation = YES; To make sure I've done things right, I log: NSLog(@"class perform is %i",self.isPerfo...

How can I manage bits/binary in c++?

What I need to do is open a text file with 0s and 1s to find patterns between the columns in the file. So my first thought was to parse each column into a big array of bools, and then do the logic between the columns (now in arrays). Until I found that the size of bools is actually a byte not a bit, so i would be wasting 1/8 of memory,...

bool from a struct lead to "error: expression must have class type"

I have a struct defined as struct sData{ idx * id; int * stime; bool * result; unsigned int N; }; Then the code that uses it in numeric compute(numeric e, sData swabs){ numeric cache=0.0; int sid=0; while(sid<swabs.N){ if(swab.result[sid]) cache += log(e); else cache += log(1.0-e); sid += 1; } retu...

1 bit per bool in Array C++

bool fp[81]; From my understanding fp should use ceil(81/8) bytes because it is in succession. Am I correct? How can I prove this? ...