Why element size is not 2?
#7
(04-23-2023, 03:31 PM)Petr Wrote: @BPlus

This is the same as what I write about above, 55 will remain there because it is in the range for the _Unsigned _Byte type. Once the field is defined as an unsigned byte, it simply stays that way forever. LEN for _Unsigned _Byte is 1 (lenght is 1 byte) To confirm, insert the number 355 instead of 55, the Unsigned Byte data type will overflow and PRINT will print 355 - 255 = 99 (because even zero is taken into account) and LEN return variable LENGHT (byte - size), not variable value, so this can not be deleted.

Oh right! sorry don't use Byte that much, thanks for reminder.

Still isn't interesting you can REDIM an UDT of same name but not a regular variable.

Another example:
Code: (Select All)
ReDim x As Integer
x = 2
redim x as long ' red lined!

You shouldn't be allowed to REDIM the 2nd s(0) as a different type than original, if you wish consistency to rule in your PL, not a great rule for Basic though ;-))
b = b + ...
Reply


Messages In This Thread
Why element size is not 2? - by Petr - 04-23-2023, 11:57 AM
RE: Why element size is not 2? - by Petr - 04-23-2023, 01:26 PM
RE: Why element size is not 2? - by SMcNeill - 04-23-2023, 01:45 PM
RE: Why element size is not 2? - by bplus - 04-23-2023, 02:22 PM
RE: Why element size is not 2? - by bplus - 04-23-2023, 02:30 PM
RE: Why element size is not 2? - by Petr - 04-23-2023, 03:31 PM
RE: Why element size is not 2? - by bplus - 04-23-2023, 03:49 PM
RE: Why element size is not 2? - by mnrvovrfc - 04-23-2023, 04:09 PM
RE: Why element size is not 2? - by bplus - 04-23-2023, 05:56 PM
RE: Why element size is not 2? - by SMcNeill - 04-23-2023, 06:15 PM



Users browsing this thread: 6 Guest(s)