.\" -*- coding: UTF-8 -*- .\" Copyright (C) 2006 Justin Pryzby .\" and Copyright (C) 2006 Michael Kerrisk .\" .\" %%%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 .\" .\" References: .\" /usr/lib/gcc/i486-linux-gnu/4.1.1/include/stddef.h .\" glibc-doc .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH offsetof 3 "3 mai 2023" "Pagini de manual de Linux 6.05.01" .SH NUME offsetof \- decalajul unui membru al structurii .SH BIBLIOTECA Biblioteca C standard (\fIlibc\fP, \fI\-lc\fP) .SH REZUMAT .nf \fB#include \fP .PP \fBsize_t offsetof(\fP\fItype\fP\fB, \fP\fImember\fP\fB);\fP .fi .SH DESCRIERE Macro \fBoffsetof\fP() returnează decalajul câmpului \fImember\fP de la începutul structurii \fItype\fP. .PP Această macro este utilă deoarece dimensiunile câmpurilor care compun o structură pot varia de la o implementare la alta, iar compilatorii pot insera numere diferite de octeți de umplutură între câmpuri. În consecință, decalajul unui element nu este neapărat dat de suma dimensiunilor elementelor anterioare. .PP Se va produce o eroare de compilare dacă \fImember\fP nu este aliniat la o limită de octet (de exemplu, este un câmp de biți). .SH "VALOAREA RETURNATĂ" \fBoffsetof\fP() returnează decalajul membrului \fImember\fP dat în cadrul tipului \fItype\fP dat, în unități de octeți. .SH STANDARDE C11, POSIX.1\-2008. .SH ISTORIC POSIX.1\-2001, C89. .SH EXEMPLE Pe un sistem Linux/i386, atunci când este compilat folosind opțiunile implicite \fBgcc\fP(1), programul de mai jos produce următoarea ieșire: .PP .in +4n .EX $\fB ./a.out\fP offsets: i=0; c=4; d=8 a=16 sizeof(struct s)=16 .EE .in .SS "Sursa programului" .\" SRC BEGIN (offsetof.c) \& .EX #include #include #include \& int main(void) { struct s { int i; char c; double d; char a[]; }; \& /* Ieșirea depinde de compilator */ \& printf("decalaje: i=%zu; c=%zu; d=%zu a=%zu\en", offsetof(struct s, i), offsetof(struct s, c), offsetof(struct s, d), offsetof(struct s, a)); printf("sizeof(struct s)=%zu\en", sizeof(struct s)); .EE .\" SRC END .PP .SH TRADUCERE Traducerea în limba română a acestui manual a fost făcută de Remus-Gabriel Chelu . .PP Această traducere este documentație gratuită; citiți .UR https://www.gnu.org/licenses/gpl-3.0.html Licența publică generală GNU Versiunea 3 .UE sau o versiune ulterioară cu privire la condiții privind drepturile de autor. NU se asumă NICIO RESPONSABILITATE. .PP Dacă găsiți erori în traducerea acestui manual, vă rugăm să trimiteți un e-mail la .MT translation-team-ro@lists.sourceforge.net .ME .