Re: [dev] [st] crash on font resize (patch inside)

From: <k0ga_AT_shike2.com>
Date: Mon, 16 Feb 2015 22:23:38 +0100

> I think the base assumptions programmers have about pointers is
> different from integers. Pointers with null values are universally
> known to be special and a case that should be checked for. With
> integers, it's not obvious what the valid range is supposed to be, in
> many cases 0 is okay. For stateful integers, it's tedious and
> error-prone to force the programmer to re-infer what valid state is.
> Without this knowledge its less clear who the perpetrator of the bug
> is.

I think a SIGFPE signal is a very clear error, and if you see it happens
in a division I don't understand what other thing can generate it.


> If you consider an assert() to be redundant in this case, at least add
> a comment next to the member definition saying "this should never be
> zero." Just so a future contributor will know for certain where the
> bug is (or isn't). You will get higher quality patches that way.

I agree here, it can be a good comment. The relation between
xloadfonts, cresize, xw.{w,h} and xw.{ch,cw} is a bit obscure,
and it is not easy to see it.

Regards,
Received on Mon Feb 16 2015 - 22:23:38 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 16 2015 - 22:36:03 CET