[riot-notifications] [RIOT-OS/RIOT] nanocoap: change method flag type to uint32_t (#10214)

Kaspar Schleiser notifications at github.com
Wed Feb 27 10:29:00 CET 2019


kaspar030 commented on this pull request.



> @@ -250,7 +250,7 @@ typedef ssize_t (*coap_handler_t)(coap_pkt_t *pkt, uint8_t *buf, size_t len, voi
  */
 typedef struct {
     const char *path;               /**< URI path of resource               */
-    unsigned methods;               /**< OR'ed methods this resource allows */
+    uint32_t methods;               /**< OR'ed methods this resource allows */

> Keeping in mind that there is no way to have more than 31 methods, `uint32_t` would be completely future proof.

Let's not forget that this is an internal field. It is fine to use the smallest type that fits *currently supported* flags. This is not a field that might suddenly be populated over the network with unexpected values.

Regarding the struct's size, alignment will make any change not really save space. A "smaller than register" value might add some masking code, though.

Honestly, the current "at least 16bit" which unsigned implies seems totally fine to me...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10214#discussion_r260659228
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190227/407895ea/attachment.html>


More information about the notifications mailing list