FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Harbour hash plus operator
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Harbour hash plus operator
Posted: Mon May 06, 2019 04: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 (fw): Select all Collapse
#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
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Re: Harbour hash plus operator
Posted: Mon May 06, 2019 07: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
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: Harbour hash plus operator
Posted: Mon May 06, 2019 08: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

Continue the discussion