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

Slice is a ref type, no need to use pointer of it here #576

Closed

Conversation

suzaku
Copy link
Contributor

@suzaku suzaku commented Jun 21, 2023

No description provided.

@suzaku suzaku force-pushed the avoid-unnecessary-pointer-usage branch from b2a82de to ddf4906 Compare June 21, 2023 09:19
Signed-off-by: satoru <satorulogic@gmail.com>
@suzaku suzaku force-pushed the avoid-unnecessary-pointer-usage branch from ddf4906 to cafb6f7 Compare June 21, 2023 09:33
@jannfis
Copy link
Contributor

jannfis commented Jul 6, 2023

Is that true? I always assumed that slices are two-fold, the slice's header is passed by value, its elements by reference. So once you start manipulating the slice itself (and not its elements) in a function, you need to pass the slice by reference (i.e. a pointer).

@suzaku
Copy link
Contributor Author

suzaku commented Jul 6, 2023

Is that true? I always assumed that slices are two-fold, the slice's header is passed by value, its elements by reference. So once you start manipulating the slice itself (and not its elements) in a function, you need to pass the slice by reference (i.e. a pointer).

Yes, we'll need to use a pointer if we intend to update the slice itself, is that the case here with Images?

@jannfis
Copy link
Contributor

jannfis commented Jul 7, 2023

is that the case here with Images

You tell me. But apparently, the unit tests are failing with this change.

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

Successfully merging this pull request may close these issues.

3 participants