RE: [GD-General] Java bitching
Brought to you by:
vexxed72
From: Rob H. <ro...@ir...> - 2002-01-06 09:47:09
|
The problem here is that a byte in java is signed. //so this will compile byte[] a = {0x7f, 0x01} //whereas 0xff is bigger than 2^7-1(0x7f) so it requires an explicit cast byte[] a = {(byte)0xff, 0x7f}; As one who has spent quite a bit of time over the last 4+ years programming in java, most of Mr. Zawinski's complaints come from a lack of knowledge about the language, but in all fairness he clarifies that at the beginning. "Therefore, some of the following complaints might have been addressed in later versions of the language, or they might have been misunderstandings on my part." Rob Hughes -----Original Message----- From: gam...@li... [mailto:gam...@li...]On Behalf Of Brian Hook Sent: Friday, January 04, 2002 10:52 AM To: Gam...@li... Subject: RE: [GD-General] Java bitching > Let me add a Java gripe! > > I was disappointed that something like > the following Java code doesn't compile: > > // Loss of precision: int to byte > byte [] a = { 0xff, 0x7f }; > > Forcing me to do this: > > // Okay > byte [] a = { (byte)0xff, (byte)0x7f }; Isn't that a compiler problem and not a language problem, or does the language assume that bytes are characters? If it's a compiler problem, then I won't fault Java for it, but if it's a language thing -- um, ick. I'm all for language purity, but when it interferes with actual, practical getting work done (like Eiffel's lack of hex constants), then I'm against it. What I DON'T like are syntactic helpers that are purely stylistic; however, this doesn't seem to be the case. Brian _______________________________________________ Gamedevlists-general mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-general |