[Vala] Cleaning up GCC warnings; dereferencing a void pointer.



Hello,

Some time back I had some trouble getting the GDK and X11 bindings
playing well together.  Jürg helped out and I got the code to compile
and work properly, but being the pedant that I am, I'd like to get rid
of the warning from gcc altogether.

The code that Vala generates is:

        real_xev = (XEvent*) (&(*xev));

The code that silences the GCC warning is:

        real_xev = (XEvent *)xev;

So, what I am wondering is, should I report a bug against Vala?  It
would seem that the expression "(&(*xev))" could be simplified to the
latter, and that simplification makes GCC happy, since the void* pointer
is no longer dereferenced and the pointer is properly cast to the
appropriate pointer type.

The line that triggers this code is:

      unowned X.Event* real_xev = (X.Event*)(&xev);

In context, it is shown here:

http://bazaar.launchpad.net/~alltray-developers/alltray/trunk/annotate/head%3A/src/AttachHelper.vala (it is 
line 65).

I have tried to write:

      unowned X.Event* real_xev = (X.Event*)xev;

As well as:

      unowned X.Event* real_xev = &((X.Event)xev);

... but Vala generates invalid code for each ("invalid use of void
expression", GCC says).

Any ideas?

        --- Mike

-- 
Blog:  http://mike.trausch.us/blog/
Misc. Software:  http://mike.trausch.us/software/

“The greater danger for most of us lies not in setting our aim too
high and falling short; but in setting our aim too low, and achieving
our mark.” —Michelangelo



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]