Re: [Fwd: Re: [Harbour] Problem with return of LoadLibrary and Harbour 11047]

2009-05-16 Thread Viktor Szakáts
Hi Mindaugas, > if hLib <= 32 && <<<-- Here error >> >> Probably 'IF Empty( hLib )' should be used here, and LoadLibrary() >> modified to return NULL when pointer is <= 32. >> >> But now I know why we had this code full of numeric pointers. >> >> We can also leave LoadLibrary() as compa

Re: [Fwd: Re: [Harbour] Problem with return of LoadLibrary and Harbour 11047]

2009-05-15 Thread Przemyslaw Czerpak
On Thu, 14 May 2009, Mindaugas Kavaliauskas wrote: Hi, > We can not return empty collectible pointer! So, simple NULL pointer > instead of collectible is also a kind of different type. Well, both has > VALTYPE() == "P", but in C code it looks like different type: Exactly and personally I prefe

Re: [Fwd: Re: [Harbour] Problem with return of LoadLibrary and Harbour 11047]

2009-05-15 Thread Viktor Szakáts
Hi Vailton, Not exactly "from now on" :) rather, it's better practice, since a normal pointer may be NULL. Even if you don't return NULL, user may pass one to your function. BTW, it can be even simpler by using this code: --- HB_FUNC (TEST) ( some *pPtr = (add *) hb_parptr(1); if (! pPtr)

Re: [Fwd: Re: [Harbour] Problem with return of LoadLibrary and Harbour 11047]

2009-05-14 Thread Vailton Renato
I have much code writing using something like this: HB_FUNC (TEST) ( some *pPtr; if (! ISPOINTER (1)) return; pPtr = (add *) hb_parptr (1); ... more code here ) As I understand it then from now on the right would add a further validation as: HB_FUNC (TEST) ( some *pPtr;

Re: [Fwd: Re: [Harbour] Problem with return of LoadLibrary and Harbour 11047]

2009-05-14 Thread Vailton Renato
I have much code writing using something like this: HB_FUNC (TEST) ( some *pPtr; if (! ISPOINTER (1)) return; pPtr = (add *) hb_parptr (1); ... more code here ) As I understand it then from now on the right would add a further validation as: HB_FUNC (TEST) ( some *pPtr;

Re: [Fwd: Re: [Harbour] Problem with return of LoadLibrary and Harbour 11047]

2009-05-14 Thread Szakáts Viktor
In my code in cases like this I return NIL instead of NULL pointer. This is better for future compatibility, if we are going to change to collectible pointers in the future. Since the value of the collectible pointer will not be NULL. My vote goes to returning same type for both e

Re: [Fwd: Re: [Harbour] Problem with return of LoadLibrary and Harbour 11047]

2009-05-14 Thread Mindaugas Kavaliauskas
Viktor Szakáts wrote: Hi Mindaugas, if hLib <= 32 && <<<-- Here error Probably 'IF Empty( hLib )' should be used here, and LoadLibrary() modified to return NULL when pointer is <= 32. But now I know why we had this code full of numeric pointers.