Re: [dwm] ntags initialization

From: Stefano Soffia <stefano.soffia_AT_studenti.unipr.it>
Date: Sat, 6 Oct 2007 16:36:04 +0200

On Fri, Oct 05, 2007 at 11:33:44PM +0200, Anselm R. Garbe wrote:
> > 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.

Sorry, I am not a `literate' C programmer. If I am not misunderstanding your
words, you are saying that the following is not a legal C program:

----- test.c ----------------------------
const char *a[] = {"0", "1", "2", "3"};
int b[sizeof(a) / sizeof(a[0])];

int main() {
  return 0;
}
-----------------------------------------

Now I am looking at the C99 standard document (ISO/IEC 9899) and I am unable
to find any reference to the aforementioned limitations of the `sizeof' and
`/' (division) operators. I'm not very good in using the standard, though.
Probably I am missing the right section. What are your sources?

greets,
gingioerge
Received on Sat Oct 06 2007 - 16:32:14 UTC

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