On Wed, 25 Jun 2008, Szakáts Viktor wrote:

Hi Viktor,

> I'd prefer a solution which won't break existing
> .prg level code, yet allows to switch from longs
> to pointers on the .c level.
> One possible solution is to allow to compare
> pointers to zero using operators (p != 0,
> p = 0, p == 0, and even p > 0, p < 0). Comparison
> with any other values would return .F., also,
> maybe NIL should be also allowed in place of 0,
> and we may allow such construct too: IF p ; ? "not null" ; ENDIF
> This would mean that a non-NULL pointer would qualify
> as .T., non-0, non-NIL and a NULL as .F., 0, NIL on
> .prg level.

EMPTY() function can be used for such testes, f.e.:

   return iif( !empty(::nSocket), sqlGetErr(::nSocket), ;
                                  "No connection to server")

It will return TRUE for 0, NIL and NULL pointers.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to