Page 1 of 1

Harbour hash plus operator

Posted: Mon May 06, 2019 4:15 am
by hua
Does anyone know why the following code under Harbour generates RTE at line h1 + h2 unless I include xhb.ch/hbcompat.ch?

Code: Select all

#include "fivewin.ch"
#include "xbrowse.ch"
#include "xhb.ch"
function main()
  local h1 := {"A" => 1}, h2 := {"A" => 2, "B" => 3}, h3

  h3 := h1 + h2
  xbrowse(h3)
return nil
 

Re: Harbour hash plus operator

Posted: Mon May 06, 2019 7:55 am
by AntoninoP
as you can see in Harbour\contrib\xhb\xhbcomp.prg the xhb adds some operators to base types.
The pure harbour method is hb_HMerge

Re: Harbour hash plus operator

Posted: Mon May 06, 2019 8:01 am
by hua
Thanks for satisfying my curiosity Antonino.
I rely heavily on xHarbour's Language Reference Guide when I start to use hashes. That's how I end up using the plus operator without knowing it's an alternative form for HMerge()/hb_HMerge()