Re: [hackers] [quark] Use sizeof() instead of magic constants || FRIGN

From: Martin Kühne <mysatyre_AT_gmail.com>
Date: Mon, 5 Sep 2016 10:15:30 +0200

sizeof var (note the lack of parens) is a feature in c. It lets the
programmer put whatever type var is in one place and one place only.
The thing that got me away from putting parentheses to sizeof was
actually the fact that only in the absolutely rarest of cases (read:
never) you take the size of a thing that is not already in a scope
variable you're working on. If you get a type passed somewhere else,
have the size passed as a size_t argument and stick with that.

I started with C writing return() and sizeof() to have it all look the
same, but that has been brought to my attention to be ignorant
practise. Those are not in that sense functions, as one is an operator
and the other a control statement.

cheers!
mar77i
Received on Mon Sep 05 2016 - 10:15:30 CEST

This archive was generated by hypermail 2.3.0 : Mon Sep 05 2016 - 10:24:14 CEST