From 1009f20d8ecdf1b8edd56b8cad94e850c07efae0 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Mon, 28 Sep 2026 00:34:30 +0800 Subject: Implement vector in C --- lab02/container_of.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lab02/container_of.h') diff --git a/lab02/container_of.h b/lab02/container_of.h index 6383572..87fb6d4 100644 --- a/lab02/container_of.h +++ b/lab02/container_of.h @@ -11,7 +11,13 @@ #define typeof_member(T, m) typeof(((T*)0)->m) - +/** + * container_of - cast a member of a structure out to the containing structure + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ #define container_of(ptr, type, member) ({ \ _Static_assert(__same_type(*(ptr), typeof_member(type, member)) || \ __same_type(*(ptr), void), \ -- cgit v1.2.3