> To: viking-devel@lists.sourceforge.net
> From: acer...@wp.pl
> Date: Fri, 8 Apr 2016 17:31:33 +0200
> Subject: [Viking-devel] viktrwlayer.cpp: invalid conversion from gpointer 
> {aka void*} to void**
>
> Hi!
>
> I hope that this is a good place to send such information to.
>
> I'm in the process of porting Viking to C++, and during compilation of
> src/viktrwlayer.cpp the compiler issued multiple errors about invalid
> conversions. Most of them were easy to fix and shouldn't be a problem in
> C program, but there are two classes of errors that I think are worth
> looking at:
>
> 1. Invalid conversion from void* to void**:
> viktrwlayer.cpp: In function ‘void waypoint_search_closest_tp(gpointer,
> VikWaypoint*, WPSearchParams*)’:
> viktrwlayer.cpp:9081:29: error: invalid conversion from ‘gpointer {aka
> void*}’ to ‘void**’ [-fpermissive]
> params->closest_wp_id = id;

There are several cases of using gpointer *variable; which were probably 
unintentional mistakes and should be simply just be gpointer variable;
I think I have fixed all the cases that are were doing the wrong thing but 
somehow the code still worked.

> 2. Invalid conversion from void* to GtkWidget**
> viktrwlayer.cpp:1378:45: error: invalid conversion from ‘gpointer {aka
> void*}’ to ‘GtkWidget** {aka _GtkWidget**}’ [-fpermissive]
> GtkWidget **ww2 = values[UI_CHG_LABELS];
>

This is not an error as values[UI_CHG_LABELS] is a pointer array (and so is 
values[UI_CHG_WIDGETS]).

So simply confirming the type casting like this is OK:

GtkWidget **ww2 = (GtkWidget **)values[UI_CHG_LABELS];

> I understand that currently Viking can be compiled and these g++ errors
> don't cause any problems in Viking. I just thought that you may be
> interested.
>
> I'm not sure if it's ok to post here compilation log +1000 lines long,
> so I have just given you two examples. You can reproduce full log for
> viktrwlayer.cpp by editing the file name in src/Makefile.am,
> regenerating build files and attempting to compile the program.
>

I simply changed the Makefile entry of CC=gcc to be CC=g++, but I then got 
bored of having to fix all the implicit type conversions that fail in C++, and 
moved viktrwlayer.c up so it would get compiled earlier.

Please report any more things that might be actual errors, rather than the C++ 
compiler being more strict on type conversions issues.

> Best regards,
> Kamil
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Viking-devel mailing list
> Viking-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/viking-devel
> Viking home page: http://viking.sf.net/
                                          
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/

Reply via email to