Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
ac149816
Commit
ac149816
authored
Oct 28, 2016
by
Doron Somech
Committed by
GitHub
Oct 28, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2177 from bluca/alignment
Problem: pointer union for zmq_msg_t is a hack
parents
0d032c99
df367a66
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
zmq.h
include/zmq.h
+14
-3
No files found.
include/zmq.h
View file @
ac149816
...
...
@@ -229,10 +229,21 @@ ZMQ_EXPORT int zmq_ctx_destroy (void *context);
/* 0MQ message definition. */
/******************************************************************************/
/* union here ensures correct alignment on architectures that require it, e.g.
* SPARC
/* Some architectures, like sparc64 and some variants of aarch64, enforce pointer
* alignment and raise sigbus on violations. Make sure applications allocate
* zmq_msg_t on addresses aligned on a pointer-size boundary to avoid this issue.
*/
typedef
union
zmq_msg_t
{
unsigned
char
_
[
64
];
void
*
p
;
}
zmq_msg_t
;
typedef
struct
zmq_msg_t
{
#if defined (__GNUC__) || defined ( __INTEL_COMPILER) || \
(defined (__SUNPRO_C) && __SUNPRO_C >= 0x590) || \
(defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x590)
unsigned
char
_
[
64
]
__attribute__
((
aligned
(
sizeof
(
void
*
))));
#elif defined(_MSC_VER)
__declspec
(
align
(
sizeof
(
void
*
)))
unsigned
char
_
[
64
];
#else
unsigned
char
_
[
64
];
#endif
}
zmq_msg_t
;
typedef
void
(
zmq_free_fn
)
(
void
*
data
,
void
*
hint
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment