From: David S. <ds...@sc...> - 2005-06-23 18:48:43
|
On Thu, Jun 23, 2005 at 01:03:39PM +0200, Thomas Vander Stichele wrote: > So, the questions: > > a) is this interpretation of compiler-like casting what we want to > achieve ? > b) or should we say instead that the value you specify should fit > naturally into the data type ? In that case, rgb masks would need to be > specified as (uint), since (int) 0xFF000000 is outside the range of > G_TYPE_INT; or it could be specified as int64. > c) what do people feel should happen when you try to deserialize the > string "-1" as a G_TYPE_UINT ? Should it fail because it's out of range, > or should it be deserialized to the value you get when you do (guint) > -1 ? I think you're overanalysing this. We use bitmasks that overload the sign bit because that's what we've always done, back to the days when adding a type was nigh impossible. I don't think anyone is particularly attached to overloading the sign bit; I don't even think anyone is attached to using bitfields, or even expressing them using the int type. Personally, I find "red_mask=(int)-16777216" rather annoying, since it doesn't describe what's actually going on, i.e., "bits 24-31". dave... -- David Schleef Big Kitten LLC (http://www.bigkitten.com/) -- data acquisition on Linux |