Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/30/07 14:58
Read: times


 
#138301 - not any more
Responding to: ???'s previous message
Erik Malund said:
Keil uses int unless told to use char and, for that reason, I thought the 'must be int' still was valid.

Apparently, this is not the case anymore.

See the quote from C-manual in my previous post. According to the changelog, this was introduced in C51 version 6.00.

I tried the following snippet in the eval version 7.50:
enum {x, y, z} ee;

main()
{
  ee = y;
  ee++;
  ee = 1234;
}

It threw the following warning:
ASDFG.C(27): warning C259: '=': different enumeration types
referring to the line where 1234 is assigned to the enum variable ee (apparently, the variable is char so 1234 won't match); and (part of) the resulting binary (as displayed in the simulator) is:
    25:   ee = y; 
C:0x08A3    750801   MOV      ee(0x08),#0x01
    26:   ee++; 
C:0x08A6    0508     INC      ee(0x08)
    27:   ee = 1234; 
C:0x08A8    7508D2   MOV      ee(0x08),#0xD2
    28: } 
C:0x08AB    22       RET      


JW


List of 15 messages in thread
TopicAuthorDate
Quick C enumerated types question            01/01/70 00:00      
   Not to worry i've found out anyway.            01/01/70 00:00      
      What's a "quick C"            01/01/70 00:00      
   The answer was.....            01/01/70 00:00      
      not really            01/01/70 00:00      
         as has been discussed before            01/01/70 00:00      
            of course not            01/01/70 00:00      
         Not true            01/01/70 00:00      
   C99 says            01/01/70 00:00      
      more details            01/01/70 00:00      
      OK            01/01/70 00:00      
         not any more            01/01/70 00:00      
         In C99            01/01/70 00:00      
            Enumeration type vs. constant            01/01/70 00:00      
               Thanks for that everyone            01/01/70 00:00      

Back to Subject List