Re: [Vala] unused variable warning in generated C code



On 12/12/2014 10:46, Nicolas CARRIER wrote:
Hello,
When I compile the following code :

public static int main(string[] args) {
    int[] b = { 2, 4, 6, 8 };
    foreach (int a in b)
        stdout.printf("%d\n", a);
    return 0;
}

with :

$ valac -C main.vala
$ gcc -Wunused-variable main.c -o main $(pkg-config --cflags --libs
glib-2.0)


I get the following warning :
main.c: In function ‘_vala_main’:
main.c:38:8: attention : unused variable ‘_a_collection_size_’
[-Wunused-variable]
   gint _a_collection_size_ = 0;
        ^
What is the reason for this warning ?
Valac not clever enough to delete unused C variables.

Is it possible to get rid of it ?
Yes, ignore C warnings. Or fix vala, in this case it's not easy so I
don't suggest doing it :)


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