Re: [dwm] ntags initialization

From: Brendan MacDonell <>
Date: Sat, 6 Oct 2007 11:29:30 -0300

On Fri, Oct 05, 2007 at 23:33:44 CEST, Anselm R. Garbe wrote:
> You miss that seltags and Client->tags are both globally defined
> in the same context as the tags definition. Afaik you can't
> evaluate the sizeof operator and you can't perform a division
> operation in a non-functional scope, so I don't see how you
> would like to replace the allocation of seltags and Client->tags
> using emallocz.

sizeof is a compile-time constant, and any expression containing only
compile-time constants (literal numbers, sizeof, etc; no variables or
functions) can be evaluated at compile time. To demonstrate, consider
the attached patch against changeset 1025 (written in standard, albeit
little-used, C) which removes the dynamic allocation of seltags and
Client->tags and replaces it with constant initialization. Due to
added whitespace where some declarations were rearranged, and a
comment, the number of LOC decreased only by 2.

Received on Sat Oct 06 2007 - 16:29:32 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:57:46 UTC