Really noob question about bytes

I’m a little ashamed to ask this ::slight_smile: but curiosity is stronger.

Is there a way to specify a byte constant like the ‘l’ for long values in long number = 0l ?

Uh, I don’t think so. If you’re assigning the value to a ‘byte’ primitive type, then there shouldn’t be a problem.

Can you be more specific? For example - why does it matter? Perhaps I can suggest a workaround if you’re running into some problem.

Because it’s really bastard annoying having to type (byte)this and (byte)that all over the sodding place >:(
And no, there isn’t :frowning: Submit an RFE, it’s a fairly trivial language tweak.
I’d quite like a binary constant annotation as well (%1010101 or something)

Cas :slight_smile:

[quote]Because it’s really bastard annoying having to type (byte)this and (byte)that all over the sodding place
[/quote]
That’s exactly the point,i have a setState(byte state) or something likely method and if i call setState(0) cause a type mismatch error.

Binary annotations would be a nice addition too, it’s anoying to rely on bitwise operators for that, anyway, you finish up knowing well the first 12 or 16 “2^n”.

btw: lol that phrase could be said by Jhon Constantine himself

Ah, now that I understand.

That’s exactly the point,i have a setState(byte state) or something likely method and if i call setState(0) cause a type mismatch error.
[/quote]
But you do know that you can cast it , right? And call setState((byte)0)

Yeah :slight_smile: What he wanted to do was setState(0b);

Cas :slight_smile:

That’s it, i was asking is there was a ‘b’ to use bytes without casting, i was just beeing curious :wink:

Nope. as Cas says its a somewhat odd syntactic omission,