Can the B(it) Type Be Expanded for Integer and Long?

The B thing B00000000 to B11111111 seems like a really handy thing to have. Wouldn't it be handy to have it for Integers? and even Longs.

Or how could a use install that in the compiling process?

Yes, I know that we are lucky to have it in the first place, as the powers that be decided not to include it in C, but wasn't C supposed to replace Assembly?

Still it would be nice to have

int I = B00000000 00000000;

I like the spaces in between.
Thanks,
BrendaEM

That would be really awkward to use.

However, you could find the Arduino file that has
B0 = 0;
B1 = 1;
B2 = 10;
B3 = 11;
etc.,
and come with your list for ints:
I0 = 0;
I10 = 1010;
I200 = 11001000;
etc.

Take a look at the file where they defined them, binary.h:

It took 509 lines just for every possible value of byte. Expanding it to longs would be huge! I wonder what kind of impact that would have on compile time?

There's no magic there. You could write your own header files with all the definitions for int and long and publish them for the use of anyone else who might find them useful. Doing so manually would be incredibly boring but you could easily write a program to automatically generate the file. I can't think of a way you could make the spaces work, you could use underlines though, which is a common convention in macro names.

Use "0bxxxxx" instead.
It's more portable anyway.
Or do what grown-ups do, and learn hex.

All binary patterns up to 16 bits would take up 66000 lines of code, 32 bits would be a multibillion line file

you can use some simple math to do what you want

int x = B01010101 * 256 + B01010101;

put this in a macro like
#define B16(c, d) ((c) * 256 + (d))

and you can write
int x = B16(B01010101, B01010101) ;

or for 32 bit

#define B32(a, b, c, d) ((((a) * 256UL + (b)) * 256UL + (c)) * 256UL + (d))

and you can write
unsigned long y = B32(B01010101, B01010101, B01010101, B01010101);

unsigned long z = B32(4, 5, 6, 7);

Why not just use the 0b syntax instead of B? It will work for any value. I have yet to figure out why the Arduino folks felt the need to define all of those constants when the same syntax was already available and worked for all values.

The "0b" syntax is not part of standard C or C++. (but it's pretty commonly implmented!)

westfw:
The "0b" syntax is not part of standard C or C++. (but it's pretty commonly implmented!)

It is part of C++14.