I don't understand this commit, and I think it just makes the code
harder to read:


    commit ceaed4a17cb3b0a14c89f10b72a636f94af97e7a
    Author: Friedrich Beckmann <friedrich.beckm...@gmx.de>
    Date:   Mon Aug 24 11:19:33 2020 +0200
    
        Warnings: function type cast for g_list_foreach
        
        I added a cast for the functions used in g_list_foreach. Without
        the cast, the warning
        warning: cast between incompatible function types
        is reported.
    
    diff --git a/src/ui/gui/dialog-common.c b/src/ui/gui/dialog-common.c
    index f167034b1..1b29c4a3b 100644
    --- a/src/ui/gui/dialog-common.c
    +++ b/src/ui/gui/dialog-common.c
    @@ -112,7 +112,7 @@ homogeneous_types (GtkWidget *source, GtkWidget *dest)
           have_type = true;
         }
     
    -  g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
    +  g_list_foreach (list, (GFunc) (void (*)(void)) gtk_tree_path_free, NULL);
    

gtk_tree_path_free is already cast to GFunc,  so what good does it do to first
cast it to something else, and _then_ to GFunc without using it?   You say that
something is reporting this as a "cast between incompatible types" - That is
what casts are for  -  to make incompatible types compatible.

Before, we had:

  (void (*) (GtkTreePath *)   -> (void (*) (void *, void *))

Now we have:

  (void (*) (GtkTreePath *)  -> (void (*) (void))  -> (void (*) (void *, void 
*))

What good does the intermediate cast do?  Which tool is issuing a warning?

J'


Reply via email to