This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RAM Space

I could not find an explanation for an observation given below.

1)When I declared bits like
bit AM,fg_chat,pumpoff=0;pumpon=0,mode=0;
bit PMP_flag = 1,buzzer=0,pumpon_flag=0;
bit xmitempty,flash1,response_received=0,response_delayed=0,sms_flag;
bit oht_red,oht_rg,glr_red,glr_rg;

my program data size was 74.3 bytes and code size 2179(there are many other variables also)
but when I declared like
bit AM,fg_chat,pumpoff=0;pumpon=0,mode=0, PMP_flag = 1,buzzer=0,pumpon_flag=0, xmitempty,flash1,response_received=0,response_delayed=0,sms_flag, oht_red,oht_rg,glr_red,glr_rg;
the data size increased to 96.7 bytes and code size 2387.
I use 89S52 uC.

Why this happens? What is difference between these?

Parents
  • "comment every definition"

    Just for the sake of completeness, it is still possible to do that; eg:

    bit
    xmitempty,             // Explain the purpose of this variable
    flash1,                // Explain the purpose of this variable
    response_received=0,   // Explain the purpose of this variable
    response_delayed =0,   // Explain the purpose of this variable
    sms_flag;              // Explain the purpose of this variable
    

    But that seems entirely pointless to me!

Reply
  • "comment every definition"

    Just for the sake of completeness, it is still possible to do that; eg:

    bit
    xmitempty,             // Explain the purpose of this variable
    flash1,                // Explain the purpose of this variable
    response_received=0,   // Explain the purpose of this variable
    response_delayed =0,   // Explain the purpose of this variable
    sms_flag;              // Explain the purpose of this variable
    

    But that seems entirely pointless to me!

Children