Re: [hackers] [quark] Use sizeof() instead of magic constants || FRIGN

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Mon, 5 Sep 2016 09:53:57 +0200

On 5 September 2016 at 09:50, FRIGN <dev_AT_frign.de> wrote:
> On Mon, 5 Sep 2016 09:42:47 +0200
> Anselm R Garbe <garbeam_AT_gmail.com> wrote:
>> Why is typedef'ing structs bad practice?
>
> because there's no reason for it other than syntax candy. It also hides

That's wrong. There are good reasons like forward declarations /
opaque type definitions that incorporate typedef.

> from the user what he is dealing with and when I want to lookup a
> struct definition I often have to jungle-jump across multiple typedef
> layers to finally reach the definition.

Of course typedef's can over-complicate code, but they can also
simplify code. I'm referring to the latter.

One can find good and bad examples, imho dwm/dmenu are good examples
of typedef usage. I'm just referring to those.

Granted, Xlib is more of the sort bad example.

Cheers,
Anselm
Received on Mon Sep 05 2016 - 09:53:57 CEST

This archive was generated by hypermail 2.3.0 : Mon Sep 05 2016 - 10:00:31 CEST