Author Topic: Issues with version 0.2.2  (Read 618 times)

0 Members and 1 Guest are viewing this topic.

Arnold

  • Hero Member
  • *****
  • Posts: 973
Issues with version 0.2.2
« on: July 15, 2019, 12:02:16 AM »
Hi Charles,

using version 0.2.2 of 2019-07-01 there are two problems in examples\Basics\Attributes.o2bas:

line 9 gives an error: linker found unidentified names

If I replace line 9 e.g. with:
string tof = typeof s : print tof  '"string"
then the demo works correctly.

I have to apply this procedure also with other types like double or int.

line 20 and 21 print 16 as a result. But the comments show 14. Should udt be a packed type?

Roland

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4419
    • Oxygen Basic
Re: Issues with version 0.2.2
« Reply #1 on: July 15, 2019, 05:46:10 AM »
Hi Roland,

Always having trouble with print, due to internal bracket placement, but this should fix it:

Code: [Select]
  procs: 'ALL COMMAND LEVEL PROCEDURES
  '===================================
  '
  '
  w3=owa 'itr macros
  if mc=-16
    if wr="mid"
      w3="_mid"
    endif
  endif
  skiplspace(s,i)
  a=ascn
  if a<>lbr '(
    if wr="print"
      w3="print"
      if not isq(a)
        w3+=" "+qu+qu
      endif
    else
      w3+="("+captsr(s,i)+")"
    endif
  endif
  inserts(s,w2+w3+" ",i)
  '
  w1=express(s,i,0)


Yes the padded size is correct (16). If it were packed it would be 14.
The rule is that the size of the largest primitive in the struct sets the padding. This ensures that arrays of structs and their members are always correctly aligned.