Alperen Erkan, le sam. 28 nov. 2026 16:37:04 +0300, a ecrit: > Just a small note on operator precedence in the proposed expression: since > subtraction binds more > tightly than the shift operator, the trailing - 1 would apply to the shift > count rather than the shifted value.
Ah, sorry, yes. > Perhaps we could write it as: > > vm_size_t max = > ((vm_size_t) 1 << (sizeof (mach_msg_type_number_t) * CHAR_BIT - 1)) - 1; Yes. > This would require <limits.h> for CHAR_BIT. ? CHAR_BIT is meaningless here. Sizeof gives you the size in bytes. It happens that char is nowadays always a byte, but that's just by luck. > C operator precedence always finds a way to catch us off guard. :) Yes, and in my mind '<<' is a multiplication so I always get caught on that one... Samuel
