Skip to content
This repository was archived by the owner on Jun 27, 2022. It is now read-only.

[Lang Enhancement Proposal] Implement PblPointer_T to differentiate between native pointers and user-defined pointers #69

Open
1 task
Tracked by #67
Luna-Klatzer opened this issue Nov 25, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request language Core language issue, change or idea

Comments

@Luna-Klatzer
Copy link
Member

Affected area by change:

  • Language Syntax: no
  • Language Library (Parac Base Library): yes
  • Compiler: yes
  • Pre-Processor: no
  • Documentation: yes

Short Introduction and Summary
With the proposal of implementing a type-tracking meta-type (#67), there is a new door opening for differentiating User-Pointers (declared/defined in Para-C) and native C-Pointers (declared/defined by the PBL and Compiler). This could enhance the clearness of code, and also allow for better handling in general, as then it can be type-checked and validated.

Is your request related to a problem? Please describe.
Currently, the implementation is thought to convert a user-pointer (*) into a C double-pointer (**) eg. a pointer points to the pointer which points to the memory. This may though be confusing with a PBL or compiler-defined pointer to pointer definition, as those will appear as equal.

Describe the solution you'd like
Implement a new type, with the following signature:

struct PblPointer{
  PblTypeMeta_T* type;
  void* val;
}; 

Describe alternatives you've considered
Perhaps remove the difference altogether of pointers and values in the generated C code of Para-C, as always they will be pointers. As such it's only important to properly implement the functionality, and have the ability to differentiate them in important cases.

Additional context

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request language Core language issue, change or idea
Projects
None yet
Development

No branches or pull requests

1 participant