[Top][All Lists]

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

Re: [RFC] Framebuffer rotation patch, or why 'unsigned' fails us

From: Colin D Bennett
Subject: Re: [RFC] Framebuffer rotation patch, or why 'unsigned' fails us
Date: Mon, 15 Feb 2010 10:35:16 -0800

On Mon, 15 Feb 2010 19:14:57 +0100
Michal Suchanek <address@hidden> wrote:

> What is left unsigned is the framebuffer size in mode info and it
> indeed requires some casts and causes trouble. It made me change one
> of the transform routines to asymmetric types because it is used
> (almost) exclusively on the mode info structure. The members of
> mode_info should not ever become negative, though and the unsigned
> type is probably meant to make that clear. I can't say if making that
> clear outweights the possible issues when using the values in
> calculations.

I think it is obvious that width and height values are never negative.
Since the data type (unsigned) is only visible the to programmer in the
declaration of the struct, not in uses of its members, I think it would
be just as effective to declare such values as signed types with a
comment at the declaration like "/* Nonnegative */" to make it clear,
and this would avoid signed/unsigned conversion/comparision problems.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]