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

Standardize use of int types across project #9

Open
twitu opened this issue Sep 12, 2020 · 9 comments
Open

Standardize use of int types across project #9

twitu opened this issue Sep 12, 2020 · 9 comments
Labels
design How should we go about this

Comments

@twitu
Copy link
Collaborator

twitu commented Sep 12, 2020

Currently different types of ints are being used. For e.g.

  1. int for config constants
  2. uint64 for key values
  3. uint32 for HashTable attributes

What is the best approach to be consistent across int type usage?

@neelkshah
Copy link
Owner

We should go for int for comparable/countable variables and uint64 for the integer data type in my opinion. The latter will allow for a larger address space and also works well as memory alignment goes

@neelkshah
Copy link
Owner

Also, do we have any specific reasons for defining hash table attributes as uint32?

@neelkshah neelkshah added the design How should we go about this label Sep 13, 2020
@twitu
Copy link
Collaborator Author

twitu commented Sep 13, 2020

  1. Going with unsigned integer because none of the hash table attributes need negative values.
  2. 32 or 64 can be decided, but we need some reference to see which one of them is better suited to memory alignment.

@neelkshah
Copy link
Owner

Let's go with uint64. It will allow us to use a larger address space. If at all we do run into memory issues later (which we shouldn't), we'll revert to uint32

@twitu
Copy link
Collaborator Author

twitu commented Sep 13, 2020 via email

@neelkshah
Copy link
Owner

Even if there is, it will be unsafe. These changes will be in a small number of files (linkedlist, hashtable). All the layers above will be agnostic to this.

@neelkshah
Copy link
Owner

We can define an alias for the type in one central location and use it everywhere, and then just make changes to it if need be.

@twitu
Copy link
Collaborator Author

twitu commented Sep 13, 2020 via email

@neelkshah
Copy link
Owner

Imo the aliasing option is the cleanest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design How should we go about this
Projects
None yet
Development

No branches or pull requests

2 participants