offsetof(3C) Standard C Library Functions offsetof(3C)NAME
offsetof - offset of structure member
SYNOPSIS
#include <stddef.h>
size_t offsetof(type, member-designator);
DESCRIPTION
The offsetof() macro defined in <stddef.h> expands to an integral constant expression that has type size_t. The value of this expression is
the offset in bytes to the structure member (designated by member-designator) from the beginning of its structure (designated by type).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO attributes(5)SunOS 5.11 29 Dec 1996 offsetof(3C)
Check Out this Related Man Page
stddef.h(3HEAD) Headers stddef.h(3HEAD)NAME
stddef.h, stddef - standard type definitions
SYNOPSIS
#include <stddef.h>
DESCRIPTION
The <stddef.h> header defines the following macros:
NULL
Null pointer constant.
offsetof(type, member-designator)
Integer constant expression of type size_t, the value of which is the offset in bytes to the structure member (member-designator), from
the beginning of its structure (type).
The <stddef.h> header defines the following types:
ptrdiff_t Signed integer type of the result of subtracting two pointers.
wchar_t Integer type whose range of values can represent distinct wide-character codes for all members of the largest character set
specified among the locales supported by the compilation environment: the null character has the code value 0 and each member
of the portable character set has a code value equal to its value when used as the lone character in an integer character con-
stant.
size_t Unsigned integer type of the result of the sizeof operator.
The implementation supports one or more programming environments in which the widths of ptrdiff_t, size_t, and wchar_t are no greater than
the width of type long. The names of these programming environments can be obtained using the confstr(3C) function or the getconf(1) util-
ity.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO getconf(1), confstr(3C), types.h(3HEAD), wchar.h(3HEAD), attributes(5), standards(5)SunOS 5.11 10 Sep 2004 stddef.h(3HEAD)
Hi,
This question might look naive, but I need to know address alignment rules used by O/S, hence posting this one.
I've following 2 structures :-
struct xyz {
char a;
int b;
char c;
}
struct abc {
char a;
char c;
int b;
}
If I print size... (2 Replies)
Hi,
I'm porting code from Windows to HP-UX 11.23, using gcc (I'm begining to suspect this might not be the best choice, but I thought it would be most compatible since we've already compiled on Linux with gcc).
I have in my code something similar to the folowing:
unsigned char *ch_arr =... (4 Replies)
Hi all,
Is anyone aware of what operations are involved when a call to pthread_self() is made, obtaining the unique thread ID on a Ubuntu system (or even any Linux flavour)?
Specifically, to retrieve the thread id, is there any locking required or atomic operations?
I'm building an... (11 Replies)