Re: [Vala] shouldn't be sizeof expression is a constant?



Hallo

const int c = sizeof(int);

this code is not compiled. Why? It's allowed in C
I've got a similar Problem. I've tryed to complie:

private const double MAX_RGB = (double)uint16.MAX;

My vala is expecting a ulong.
Also sizeof apparently isn't considered a constant in Vala. Which
means you cannot use const. This works for me:

ulong c = sizeof(int);

I'm sorry, but I don't understand. :( Should I generaly do not use
constants? How do I use them?




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