Problems with initialization of a byte array, INLINE Java IS NECESSARY...
I was ready to write a message given below with a proposition to support
inline Java codes to handle primitive data ( say to have a conveniet array
initialization or to have an
opportunity to use powerfull shift operation <<<, >>> with a byte data ),
when Antoon Verhoeven proposed the same.
I've detected that hexPrint example program from the RedBook types
character "?" intead of bytes x'88' and x'98'. I've decided to check
where an error lies and I've wrote the most natural for me definition
of a byte array:
ascii = [ byte '╪', '?', '%', '-', '?', 'T' ] -- 87 88 89 97 98 99 ( DOS
coding is used here )
System.out.println( String( ascii ) )
Say Rexx String( ascii )
The result of execution was:
NetRexx portable processor, version 1.113
Copyright (c) IBM Corporation, 1997. All rights reserved.
40 +++ ascii = [ byte 135, 136, 137, 151, 152, 153 ] -- 87 88 89 97 98 99
+++ Error: Cannot convert value of type 'short' for assignment to array
element of type 'byte'
Compilation of 't.nrx' failed [one error]
It was natural for me to define type of elements of an array only once but
to exclude this error message it appeared necessary to write "byte" near
ALL elements of this array. Besides even schoolboy knows that byte values
lies in [0,255] region and thus would be surprized by the message above.
Skipping the other details it appeared that only ascii definition in a
rather unnatural form: