Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require function prefixes for static and global functions #27

Open
Garados007 opened this issue Jan 2, 2023 · 1 comment
Open

Require function prefixes for static and global functions #27

Garados007 opened this issue Jan 2, 2023 · 1 comment

Comments

@Garados007
Copy link
Member

Thomas requested this in byte-physics/igortest#327 (comment) but I need more clarification:

  • Do we really want a function prefix for static functions as well? These are only accessible inside the module and therefore is no benefit using a function prefix. I support requiring a function prefix for global functions as they can clash with other user functions.
  • How do we determine the name of the function prefix? There should be a rule.

Currently, function prefixes are only mentioned once in the coding convention and that is that they may be used before the name of a function.

@t-b
Copy link
Member

t-b commented Jan 4, 2023

Current proposal:

  • Function prefixes are optional. If you use them for one function, all functions, regardless of static/threadsafe/etc. must have them. Constants and structures as well. Always restricted to one file.
  • Globally accessible functions, e.g. part of the API, should always have a function prefix to avoid name collisions. Exceptions must be documented.
  • If regular modules, i.e. #pragma moduleName=XXX, are used the following rules should be followed:
    • All module names start with the global prefix, i.e PREFIX_ModuleName
    • Function prefixes are the same as global prefixes
    • For very large projects, one can have multiple global prefixes.
  • Prefixes for different projects should be different if possible. So try finding a unique global prefix.

@t-b t-b removed the question label Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants