Discussion:
[xHarbour-developers] Bug in hb_pcount()
Enrico Maria Giordano
2015-10-04 22:22:19 UTC
Permalink
The following sample returns 64 for any number of parameter passed to
TEST() function:

FUNCTION MAIN()

? TEST( 1 )

INKEY( 0 )

RETURN NIL


#pragma BEGINDUMP

#include "windows.h"
#include "hbapi.h"


HB_FUNC( TEST )
{
hb_retnl( hb_pcount() );
}

#pragma ENDDUMP

EMG

--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG Music page: http://www.emagsoftware.it/emgmusic
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg

------------------------------------------------------------------------------
Enrico Maria Giordano
2015-10-05 13:12:20 UTC
Permalink
With this change it returns 1. I'm confused...

FUNCTION MAIN()

? TEST( 1 )

INKEY( 0 )

RETURN NIL


#pragma BEGINDUMP

#include "windows.h"
#include "hbapi.h"

#undef hb_pcount // THIS CHANGE

HB_FUNC( TEST )
{
hb_retnl( hb_pcount() );
}

#pragma ENDDUMP

EMG

--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG Music page: http://www.emagsoftware.it/emgmusic
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg

------------------------------------------------------------------------------
Enrico Maria Giordano
2015-10-05 14:12:44 UTC
Permalink
It seems that I have to change the C compiler alignment from 4 to 8 (I
used 4 since years). Is it the proper fix and alignment?

EMG

--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG Music page: http://www.emagsoftware.it/emgmusic
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg

------------------------------------------------------------------------------
Loading...