GNOME Bugzilla – Bug 540670
Cannot pass const values to function without warning.
Last modified: 2009-07-27 15:39:49 UTC
Passing const values to a function results in a warning. We also cannot declare the function as accepting a const value (not sure if this is a good idea or not). /* * valac test.vala */ using GLib; public class Test : GLib.Object { private static const int[] NUMBERS = { 1, 2, 3 }; public static void test(int[] numbers) { } public static void main(string[] args) { test(NUMBERS); } } Compiler warning: test.c: In function ‘test_main’: test.c:23: warning: passing argument 1 of ‘test_test’ discards qualifiers from pointer target type
Confirming, requires decision how to handle const arrays compared to buffer parameters.
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of 539703 ***