Improved generation in C for constant parameters
Vala generates C warnings following conversion to constant:
void teste(Vector2i position)
{
Vector2i pos;
pos = position;
print("%d and %d\n", pos.x, pos.y);
}
struct Vector2i{
int x;
int y;
}
const Vector2i position = {42, 61};
void main()
{
teste(position);
}
it would be interesting to be able to do :
void teste(const Vector2i position);
which is still impossible today
or we'll stay like this and try to make the cast in const more cleanly.
I also noticed that vala does not cause the warning when you do this:
const Vector2i position = {42, 61};
void main()
{
Vector2i tmp = position;
teste(tmp); // no C warning
}
this could be done in the background, for my part I prefer a better implementation of constants in vala, because they are not really used except for define generation Here I let you debate :)
Edited by Ghost User
