From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why does Labview take 8 bits to represent a Boolean?

Solved!
Go to solution

Since it can take only one of two values, can it not be represented by a bit?

0 Kudos
Message 1 of 9
(3,727 Views)
Solution
Accepted by AJ_CS

The memory controllers smallest unit is a byte, and reading from memory is done 32 bit at a time, so there's no benefit to use a single bit. If you use alot of bits, you can mask them into an I32 which is often done in e.g. C.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 9
(3,722 Views)

OK..I get it..I also felt there would be some thing like smallest unit or so..thank for clarifying..

0 Kudos
Message 3 of 9
(3,716 Views)

The benefit of booleans is that even when you're wrong, you're only a bit off. 😉

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 4 of 9
(3,709 Views)

@Yamaeda wrote:

The benefit of booleans is that even when you're wrong, you're only a bit off. 😉

/Y


Unless you are having fun with Type Casting

0 = False

Everything Else = True


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 9
(3,664 Views)

@crossrulz wrote:

@Yamaeda wrote:

The benefit of booleans is that even when you're wrong, you're only a bit off. 😉

/Y


Unless you are having fun with Type Casting

0 = False

Everything Else = True


I guess that's like arguing with girlfriend/wife; when all bits align you're right, else you're wrong! 😄

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 6 of 9
(3,657 Views)

Early versions of LV did use packed bits but as processors became more powerful and memory became cheaper the overhead to pack and upack the bits outweighed the smaller memory footprint.

 

Lynn

0 Kudos
Message 7 of 9
(3,613 Views)

Only for boolean arrays. And skalar booleans were 16 bit which was the standard boolean format on MacOS 6 + 7. The complication and performance loss with packing and unpacking, made the LabVIEW developers change the boolean representation in LabVIEW 5 to be byte sized, like most C++ compilers use too, and to forget about packing for boolean arrays.

Rolf Kalbermatter
My Blog
Message 8 of 9
(3,600 Views)

Rolf,

 

Thank you for correcting the details.

 

Lynn

0 Kudos
Message 9 of 9
(3,591 Views)