Menu

#71 'unsigned int' explicit casts

closed-wont-fix
nobody
5
2007-08-29
2007-08-29
Anonymous
No

When CIL parses a binary operation that compares 2 variables of a non-primitive type, it adds '(unsigned int)' explicit casts in front of the variables.
I guess there is no reason to do so.

Example :

struct rb_red_blk_node {
...
...
};

rb_red_blk_node *x;
rb_red_blk_node *y;
int b;

b = x==y;

This line becomes :

b = (unsigned int )x == (unsigned int )y;

Discussion

  • Matt Harren

    Matt Harren - 2007-08-29
    • status: open --> closed-wont-fix
     
  • Matt Harren

    Matt Harren - 2007-08-29

    Logged In: YES
    user_id=1278428
    Originator: NO

    CIL enforces the rule that comparisons are only done on integer types. There's no strong reason for this rule, but there's no strong reason to change it either. See also 1211894.

    -- Matt

     

Log in to post a comment.