• Type promotion bug?
    Specific pointer -> generic pointer -> boolean (i.e. implicit compare to 0) seems not to work as expected. void main() { char* p; char* q; char xdata* xp = NULL; bit fail = FALSE; // This...
  • Integral Promotion
    We are currently in the process of evaluating Keil tools for possible purchase. Using the evaluation package, I have been checking some common functions. One of them is a simple bit test macro suitable...
  • BUG with bits in integer variable
    There is a BUG in the compilation of a bit definition: unsigned int bdata my_int; sbit bit15 = my_int ^ 15; sbit bit7 = my_int ^ 7; void main() { my_int = 0x8000; if(bit15) { // Here we shall...
  • Timer, t1-t0, integral promotion
    For ARM7, A hardware timer is 32-bits, and unsigned int is 32-bits too; For a 16-bits MCU, A hardware timer is 16-bits, and unsigned int is 16-bits too; So, t0 = timer_val; while ( ( timer_val...
  • Integer overflow
    Hello to everyone. When I have to calculate the average of two integer numbers, first i have to add them. Sometimes an overflow occurs. One technique maybe to compare the result to one of the numbers...