Re: [dwm] ntags initialization

From: Anselm R. Garbe <>
Date: Wed, 10 Oct 2007 16:49:15 +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.

One question to this again. Actually I can't find any official
reference why this should work in the C89 standard, call me
blind or whatever. In C99 this definately works.

Do you have a pointer to confirm that this works with C89 as

To the people complaining about third-party patch integration
troubles with the Client struct definition, I consider two
options at the moment. Wether I define an TagArr type or I
revert to the old emallocz version.


 Anselm R. Garbe >< >< GPG key: 0D73F361
Received on Wed Oct 10 2007 - 16:49:15 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:58:53 UTC