Re: [dwm] ntags initialization

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Sat, 6 Oct 2007 19:43:43 +0200

On Sat, Oct 06, 2007 at 11:29:30AM -0300, Brendan MacDonell wrote:
> 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.

You are right, applied.

Regards,

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Sat Oct 06 2007 - 19:43:43 UTC

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