ZMQ_MSG_INIT_SIZE(3)
π zmq_msg_init_size β bestie edition π
okay so you're in the 0MQ manual (that's ZeroMQ, the messaging library, hi π) and you clicked on zmq_msg_init_size. slay. let's get into it π«Ά
β¨ NAME β¨
zmq_msg_init_size β initialise a 0MQ message of a specified size π
β¨ SYNOPSIS β¨
int zmq_msg_init_size (zmq_msg_t *msg, size_t size);
β¨ DESCRIPTION β¨
So zmq_msg_init_size() shall allocate literally every resource you need to store a message that's size bytes long, and then it initialises the message object that msg points to, so that it represents that freshly allocated message. new message, who dis π
The implementation gets to choose whether it stores the message content on the stack (for small messages, cute and cozy) or on the heap (for large messages, main character storage energy). It's the implementation's call, not yours, bestie.
And for performance reasons? zmq_msg_init_size() shall not clear the message data. That's not a bug, that's a feature β it's not gonna waste time zeroing stuff out for you. So don't be surprised when the bytes are justβ¦ whatever they are. π
β οΈ Caution β οΈ Never accesszmq_msg_tmembers directly, bestie, I am begging. Always use thezmq_msgfamily of functions. no cap, that's the rule π
β οΈ Caution β οΈ The functionszmq_msg_init(),zmq_msg_init_data(),zmq_msg_init_size()andzmq_msg_init_buffer()are mutually exclusive. Never initialise the samezmq_msg_ttwice. like. never ever. it's giving undefined behaviour and we do not want that π
β¨ RETURN VALUE β¨
zmq_msg_init_size() shall return zero if it succeeded π otherwise it shall return -1 and set errno to one of the values defined below. sad girl hours, but at least you get an errno π
β¨ ERRORS β¨
ENOMEMβ Insufficient storage space is available. the vibes are simply not there, there's no room π
β¨ SEE ALSO β¨
zmq_msg_init_data(3)zmq_msg_init_buffer(3)zmq_msg_init(3)zmq_msg_close(3)zmq_msg_data(3)zmq_msg_size(3)zmq(7)
β¨ AUTHORS β¨
This page was written by the 0MQ community π«Ά (yes, the whole community, iconic behaviour). If you wanna make a change, please read the 0MQ Contribution Policy at http://www.zeromq.org/docs:contributing before you go feral in the repo, okurrr? π
and that's the whole page, bestie β you ate that π β¨
this was page ZMQ_MSG_INIT_SIZE(3) from 0MQ version 4.3.5, dated 10/09/2023 π
π¦ where this page comes from
- epel 10: zeromq 4.3.5-18.el10_0 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 43: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 43: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 44: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 44: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms