From 22675cd8dc75d8b8d4b0f818f5b093efbc364802 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Fri, 8 Aug 2025 22:44:15 +0200 Subject: vault backup: 2025-08-08 22:44:15 --- ... to heap data as an argument to a function transfers its ownership.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Passing a pointer to heap data as an argument to a function transfers its ownership.md (limited to 'Passing a pointer to heap data as an argument to a function transfers its ownership.md') diff --git a/Passing a pointer to heap data as an argument to a function transfers its ownership.md b/Passing a pointer to heap data as an argument to a function transfers its ownership.md new file mode 100644 index 0000000..754f141 --- /dev/null +++ b/Passing a pointer to heap data as an argument to a function transfers its ownership.md @@ -0,0 +1 @@ +Passing a variable into a parameter of a function is basically an assignment. So if we pass a pointer to heap data to a function the [[Moved heap data principle]] states that ownership is passed to that function. Thus the original variable can not be used anymore, for example after the function returns. \ No newline at end of file -- cgit v1.2.3