What programming languages have a bit as variable type?
- Codemss
- Veteran
- Posts: 124
- Joined: Sun Jun 24, 2007 6:49 am
- Location: Utrecht, The Netherlands
- Contact:
What programming languages have a bit as variable type?
What programming languages have a "bit" as variable type? I saw QB64 has. This is very useful. In a engine wher eI scroll an large monochrome map. For this, I have to make an array of integers, load them with PEEK and POKE(because they use bytes) and then use a byte-to-bit LUT, and again a 8-bits-tobyte LUT. This is not very practical...
PS Someone told me that you can decalre a variable as a bit in FB(or was it a BYTE?) too, but I'm pretty sure he meant an other language or he made a mistake, because it just doesn't work in FB. It would be a great feature though. Just like SHL and SHR. Very useful.
PS Someone told me that you can decalre a variable as a bit in FB(or was it a BYTE?) too, but I'm pretty sure he meant an other language or he made a mistake, because it just doesn't work in FB. It would be a great feature though. Just like SHL and SHR. Very useful.
Check out my site: <a href="http://members.lycos.nl/rubynl">Click here</a>
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL
Having a BIT variable type is a tremendously bad idea because it isn't the way the CPU works. The smallest amount of data you can directly access is the byte, and there is no way around this. In order for a BIT variable type to work, a full byte has to be used, leaving seven bits unused. This could add up pretty quickly, and is more than likely the reason why no normal compiler features a bit type...it's terribly wasteful, inefficient, and requires special code in the runtime library to handle it, expanding the final binary size further.
- Codemss
- Veteran
- Posts: 124
- Joined: Sun Jun 24, 2007 6:49 am
- Location: Utrecht, The Netherlands
- Contact:
Too bad... So I still have to make byte-to-bit LUTs, and 8-bits-to-byte LUTs.
Ok thanks.
Greets,
Codemss
Ok thanks.
Greets,
Codemss
Check out my site: <a href="http://members.lycos.nl/rubynl">Click here</a>
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Why not have it?
Apparently there are some uses for it. Serial ports send bits of information and I am sure somebody could use it in other ventures.
What would a person who does not even code anymore use it for N ?
Why would somebody go to the trouble of making one if it did not provide some kind of an advantage? Hmmmmmmmm........
Ted
What would a person who does not even code anymore use it for N ?
Why would somebody go to the trouble of making one if it did not provide some kind of an advantage? Hmmmmmmmm........
Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
You can use pieces of numbers. Lets say variable type Byt is 0 through 100. In decimal, you can use place-values for separate numbers, ie 43 can be 4 and 3. Binary would be something like 13 is 3 and 1 (1101:11 01). You can break up numbers into bits. But to manipulate the bits themselves is another matter.
For any grievances posted above, I blame whoever is in charge . . .
- Codemss
- Veteran
- Posts: 124
- Joined: Sun Jun 24, 2007 6:49 am
- Location: Utrecht, The Netherlands
- Contact:
Well, it is much easier to use when you can define how much bits you need for one variable. Also it is much easier when you want to do something that's monochronome.
Check out my site: <a href="http://members.lycos.nl/rubynl">Click here</a>
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL
-
- Veteran
- Posts: 399
- Joined: Wed Mar 02, 2005 9:01 pm
- Location: Nashville, Tennessee
- Contact: