Skip to content

Commit

Permalink
"small" tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Feb 20, 2024
1 parent e111167 commit daa6241
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,12 @@ This is probably what you expect if you have mostly used high-level languages,
like Python or JavaScript.
In fact, in Python, **all** objects are passed around as pointers.

You don't need a pointer when the value is small enough to be passed around as is.
You usually don't need pointers for small objects.
For example, if you want to make a function takes two `int`s and prints them,
just make a function that takes two `int`s.
On the other hand, if your function takes an array of 1000000 `int`s and prints them,
On the other hand, if your function takes an array of 100000 `int`s,
you should use a pointer.
Passing around hundreds or thousands of bytes without pointers is usually a bad idea.


## Undefined Behavior (UB)
Expand Down

0 comments on commit daa6241

Please sign in to comment.