On Thu, Oct 04, 2007 at 08:17:51AM +0100, [EMAIL PROTECTED] wrote:
> feature by looking at the dwm code when I found:
> 
>   for
> (ntags = 0; tags[ntags]; ntags++);
> 
> which,  I suppose,  is used to 
> initialize the `ntags' variable. However this point is not clear to me 
> since
> `tags' is statically defined, then it would be possible to 
> compute statically `ntags' as
> 
>   ntags = sizeof tags / sizeof tags[0] - 
> 1;

That's true, but an evolutionary artefact ;) I'm going to
replace this with the sizeof calculation, but with the exception
to also remove the NULL array-terminator. This makes the -1
calculation obsolete.

 BE CAREFUL with the tags definition beginning with dwm 4.6,
 NULL won't be allowed anymore!!!

> and, as a side effect, knowing statically `ntags' allows to define 
> `seltags' as an array without using
> `emallocz()'. 
> What I am missing?

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.

Regards,
-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361

Reply via email to