Skip to content

Ptr or Ref #15

Description

@mgkuhn

Pre-defined Win32 API aliases for bits types such as

const BYTE = Cuchar
const BOOL = Cint
const BOOLEAN = BYTE
const DOUBLE = Cdouble
const DWORD = Culong

seem mostly uncontroversial and straight forward.

But what about aliases for pointer types, such as

const PDWORD = Ptr{DWORD}
const LPDWORD = Ptr{DWORD}

Should these really be Ptr{} or Ref{}?

Or should they remain undefined, to force the user to think about that difference for each use case themselves? In other words, should the user not write Ptr{HANDLE} or Ref{HANDLE} instead of PHANDLE?

Or should bits aliases, Ptr{} aliases and Ref{} aliases all go into separate modules or submodules, so that the Ptr{} vs Ref{} choice can be made by the user at import time?

Could the documentation for these types provide some more guidance on pointers?

(I don't have any answers yet; I just wanted to open an issue to collect thoughts on the subject.)

See also When to use T, Ptr{T} and Ref{T}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions