.\" -*- coding: UTF-8 -*- .\" Copyright 2006, Justin Pryzby .\" Copyright 2006, Michael Kerrisk .\" Copyright, the authors of the Linux man-pages project .\" .\" %%%LICENSE_START(PERMISSIVE_MISC) .\" Permission is hereby granted, free of charge, to any person obtaining .\" a copy of this software and associated documentation files (the .\" "Software"), to deal in the Software without restriction, including .\" without limitation the rights to use, copy, modify, merge, publish, .\" distribute, sublicense, and/or sell copies of the Software, and to .\" permit persons to whom the Software is furnished to do so, subject to .\" the following conditions: .\" .\" The above copyright notice and this permission notice shall be .\" included in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, .\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY .\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, .\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE .\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH offsetof 3 "8 فبراير 2026" "صفحات دليل لينكس 6.18" .SH الاسم offsetof \- إزاحة عضو في بنية .SH المكتبة مكتبة سي المعيارية (\fIlibc\fP،\ \fI\-lc\fP) .SH موجز .nf \fB#include \fP .P \fBsize_t offsetof(\fP\fItype\fP\fB, \fP\fImember\fP\fB);\fP .fi .SH الوصف تعيد الكلية \fBoffsetof\fP() إزاحة الحقل \fImember\fP من بداية البنية \fItype\fP. .P هذه الكلية مفيدة لأن أحجام الحقول المكونة للبنية قد تختلف عبر التطبيقات، وقد تُدرج المصرّفات أعدادًا مختلفة من البايتات الحشوية بين الحقول. وبالتالي، لا تُعطى إزاحة عنصر بالضرورة بمجموع أحجام العناصر السابقة. .P سينجم خطأ في المصرّف إذا لم يكن \fImember\fP محاذيًا لحد بايت (أي إذا كان حقل بتات). .SH "قيمة الإرجاع" تعيد \fBoffsetof\fP() إزاحة \fImember\fP المعطى ضمن \fItype\fP المعطى، بوحدات البايت. .SH المعايير C11, POSIX.1\-2008. .SH التاريخ POSIX.1\-2001، C89. .SH أمثلة على نظام Linux/i386، عند الترجمة باستخدام خيارات \fBgcc\fP(1) المبدئية، يُنتج البرنامج أدناه المخرجات التالية: .P .in +4n .EX $\fB ./a.out\fP offsets: i=0; c=4; d=8 a=16 sizeof(struct s)=16 .EE .in .SS "مصدر البرنامج" .\" SRC BEGIN (offsetof.c) \& .EX #include #include #include \& int main(void) { struct s { int i; char c; double d; char a[]; }; \& /* Output is compiler dependent */ \& printf("offsets: i=%zu; c=%zu; d=%zu a=%zu\[rs]n", offsetof(struct s, i), offsetof(struct s, c), offsetof(struct s, d), offsetof(struct s, a)); printf("sizeof(struct s)=%zu\[rs]n", sizeof(struct s)); \& exit(EXIT_SUCCESS); } .EE .\" SRC END .PP .SH ترجمة تُرجمت هذه الصفحة من الدليل بواسطة زايد السعيدي . .PP هذه الترجمة هي وثيقة مجانية؛ راجع .UR https://www.gnu.org/licenses/gpl-3.0.html رخصة جنو العامة الإصدار 3 .UE أو ما بعده للاطلاع على شروط حقوق النشر. لا توجد أي ضمانات. .PP إذا وجدت أي أخطاء في ترجمة صفحة الدليل هذه، يرجى إرسال بريد إلكتروني إلى قائمة بريد المترجمين: .MT kde-l10n-ar@kde.org .ME .