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



Hello,

                  في ث، 29-03-2011 عند 05:36 +0200 ، كتب Leonhard Küper:
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_RG
B = (double)uint16.MAX;

The problem here is that uint16.MAX isn't declared as a constant in the
VAPI, this is probably a bug.


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?

a sizeof expression isn't considered constant. I'm not sure whether this
is intentional or just a bug.

Regards,
Abderrahim




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