lightdash: Preferences window freezes after opening dashboard

Matthew Brush mbrush at codebrainz.ca
Sun Sep 6 18:51:41 CEST 2015


On 15-09-05 11:00 AM, Jonas Kümmerlin wrote:
> Am Freitag, den 04.09.2015, 17:35 -0700 schrieb Matthew Brush:
>> FYI, you can trivially find problems like that by using stronger
>> compiler warnings like `-Wall -Wextra -Werror`. That way it will almost
>> never compile successfully if you have such bugs in your code.
>
> Nope, the explicit cast will shut up any warnings.
>

Ah, I didn't look at the code, I was assuming it was a function with a 
return type not returning anything (so defaulting to int). Yeah, casting 
away what little bit of type-safety C offers is a sure way to get the 
compiler to ignore your bugs :)

> Unless you also make sure the callback has the explicit same prototype as
> expected so you can get rid of the cast. Which might have been possible (but not

It's safer, at least. Compiler warnings/errors are much better than 
manually finding such bugs by code-review/debugging.

> necessarily better coding style) in this case, but is not universally useful
> e.g. when connecting gobject signals.
>

Indeed, though I wouldn't consider that a good feature/style of the 
GObject API. It's actually not even technically valid C code because 
GObject casts the callback function pointer to a void*, which AFAIK 
isn't permitted by the standard, but luckily it works on the compilers 
most people care about.

Cheers,
Matthew Brush


More information about the Xfce4-dev mailing list