How can I assign empty pointer to variable?
C level function: hb_retptr( NULL );
Hi,


I can do it in C, so I've wrote a EMPTYPTR() function with
   hb_retptr( NULL );
but I'm asking about compiler based 0p0 (just like 0d0 or 0t0 for empty date or timestamp) solution. Does such solution exist?

Don't know about PRG level, but since pointers are usually not created
on the PRG level it is reasonable.
Well, for long time I've been using numeric value to store pointers and 
handles, because pointer type was not implemented in Clipper, 
[x]Harbour. Now I'm changing this these variables to true pointer type.
Usually the .prg code changes are:
  IF nPtr != 0      to     IF ! EMPTY( pPtr )
But sometimes, I need to initialize pointers (or pass NULL pointers to some function). The previous solution was:
  nPtr := 0
and I want to change to something like:
  pPtr := 0p0
In some cases NIL and 0 had different meaning: NIL - resource is not allocated, I should try to allocate it; 0 - resource allocation failed, ex., such resource does not exist; otherwise value is valid pointer. In this case using NIL instead of EMPTY/NULL pointer is also not a solution.

Best regards,
Mindaugas

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

Reply via email to