title: Can this macro be converted to a function?
body: <p>While refactoring code and ridding myself of all those #defines that we're now taught to hate, I came across this beauty used to calculate the number of elements in a structure:</p>
  
  <pre><code>#define STRUCTSIZE(s) (sizeof(s) / sizeof(*s))
  </code></pre>
  
  <p>Very useful as it is but can it be converted into an inline function or template?</p>
  
  <p>OK, ARRAYSIZE would be a better name but this is legacy code (no idea where it came from, it's at least 15 years old) so I pasted it 'as is'.</p>