Re: [dwm] malloc'ed client in manage()

From: Szabolcs Nagy <nszabolcs_AT_gmail.com>
Date: Tue, 9 Sep 2008 09:13:49 +0200

On 9/8/08, Anselm R Garbe <garbeam_AT_gmail.com> wrote:
>> but if we really care about obscure 30 year old cpus (other than x86
>> :)) then i'd go with my solution: c = malloc(); and *c = (Client){};
>
> Well, I agree on this proposal and go for it. It is fairly simple and
> nice looking imho.

sorry i misread the standard
eventhough it sais

"If there are fewer initializers in a brace-enclosed list than there
are elements or members of an aggregate, or fewer characters in a
string literal used to initialize an array of known size than there
are elements in the array, the remainder of the aggregate shall be
initialized implicitly the same as objects that have static storage
duration."

the initializer list must contain at least one element so the empty {}
is not enough. (easy to overlook since it is not stated explicitly,
just the result of the given initializer grammar)

Client can be initialized with {""} (first member is .name) or {.x =
0} or whatever, but general zero-init is impossible this way :(

tl;dr: use the original patch
Received on Tue Sep 09 2008 - 07:13:49 UTC

This archive was generated by hypermail 2.2.0 : Tue Sep 09 2008 - 07:24:04 UTC