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

DataType: decide what type should be the arg of SetSize (for 32b platforms) #11

Open
sbinet opened this issue Aug 11, 2017 · 1 comment

Comments

@sbinet
Copy link
Member

sbinet commented Aug 11, 2017

details:

In C, H5Tset_size takes a size_t as argument to set the total size of the DataType.
This was translated into DataType.SetSize(sz uint).

This wasn't taking into account the special value -1 that is used to make a DataType of variable size.

we could settle for Go's int but that would be wrong for 32b platforms.
perhaps use an explicit int64 ?

@kortschak
Copy link
Member

I think int is correct here. As mentioned in an afterthought comment, Go int and C size_t are likely to be the same size (not in NaCl, and certainly not guaranteed). I don't think we can guarantee that we are going to do the correct thing. We can however guarantee that we won't do the wrong thing. Because of the fact that we are depending on CGO, we know that we won't be running on NaCl, but we can also have an init function that ensures that unsafe.Sizeof(int(0)) == C.sizeof(size_t) and panics otherwise. There are probably other sanity checks that would be worth considering here too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants