Re: [Vala] error: Non-constant field initializers, but the initializer seems constant



From: Luca Bruno <lethalman88 gmail com>
To: vala-list gnome org

On 12/12/2014 15:31, Nicolas CARRIER wrote:

    namespace Plop {
        int my_int = -1;
        static void check_my_int_is_initialized() {
            if (my_int < 0)
                my_int = 42;
        }
        public static int main(string[] args) {
            check_my_int_is_initialized();
            stdout.printf(@"my_int is $my_int\n");
            return 0;
        }
    }

That's an interesting bug. I think vala threats that -1 as unary
operator of negation. Should be trivial to fix. Feel free to report a bug.

---

Ok ! Thank for the explanation.

I haven't used bugzilla yet. I will try to submit my first bug ASAP.

PS: I don't receive the mails from the mailing list, it's really annoying, I have to copy / paste from the mailing-list's site in order to answer...

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