ASML C Coding Standard

Synopsis: | Unary minus shall only be applied to an operand having a signed arithmetic type. |

Language: | C |

Severity Level: | 1 |

Category: | Expressions |

Description: |

Unary minus on an unsigned expression gives an unsigned result which is never negative; unary minus on a non-arithmetic expression is not allowed.
long j; unsigned int i = 1; signed int k = 1; ... j = -i; /* WRONG: very large positive number */ j = -k; /* RIGHT */
The negative is taken |