Harbour hash plus operator

Harbour hash plus operator

Postby hua » Mon May 06, 2019 4:15 am

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  Expand view

#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
 
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Harbour hash plus operator

Postby AntoninoP » Mon May 06, 2019 7:55 am

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
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: Harbour hash plus operator

Postby hua » Mon May 06, 2019 8:01 am

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()
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 107 guests