Re: [Vala] handling of 'uchar' type



On Die, 2007-04-24 at 06:52 -0500, Michael Lawrence wrote:
Hi,

I am truly excited about the Vala project. The developers are
extremely responsive and fix many bugs immediately after they're
reported.

Thanks :)

Would it be possible to treat uchar more like (u)int? That is, allow
it to be used for indexing into arrays and automatically cast literals
in comparisons? 

Using uchar as array index should be easy to fix.


For example:

foo(uchar b) {
  if (b > 0) {
  }
}

Currently gives an error for the comparison of 'b' and '0' unless I
cast 0 to uchar.

That should certainly be fixed, we'll have to check how to handle such
conversions in general.

As an aside, it would be nice if the "if" statement would
automatically coerce numbers to logicals (so I could say "if (b)"
there instead of "if (b > 0)").

We don't want to allow automatic conversion from integer to boolean,
that would be error-prone and could lead to less legible code. We follow
Java and C# in that regard.

It would also be great if Vala parsed hexadecimal literals like 0xff. 

Vala already supports hexadecimal literals. Please file a bug if there
are problems with the implementation.

Jürg




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