is_local() on null gptr

Issue #57 resolved
Dan Bonachea created an issue
bool result = global_ptr<T>(NULL).is_local()

What should this return?

This is ambiguous in the current spec.

Possible resolutions include:

  1. Add a precondition forbidding this method call on null global pointers
  2. Add text guaranteeing a false return for null global pointers
  3. Add text guaranteeing a true return for null global pointers

Note that .1 and .2 also imply that global_ptr<T>(NULL).local() is prohibited, which seems overly restrictive and likely to add branches in code that is written to localize (non-remote) gptrs without regard to their specific value (or null-ness). FWIW, UPC allows down-casts of pointer-to-shared NULL to pointer-to-local NULL, without no special care required.

I vote for resolution .3

Comments (2)

  1. Log in to comment