Change to sdcc-2.8.0

Huy Nguyen
2008-04-25
2013-03-12
  • Huy Nguyen

    Huy Nguyen - 2008-04-25

    Hi all,

    Can help me in this situation. It's compiled well on SDCC-2.7.0
    but show error in SDCC-2.8.0

    Please look at the following code:
    --------------------------------------------------------------------------------
    float Eeprom_Read_Float(unsigned int addr)
    {
          float temp_float;
          char *ptr;
          unsigned char i;

          ptr=&temp_float;

          for (i=0;i<4;i++){
              *(ptr++)=EEPROM_get(addr++);
        }
          return temp_float;
    }

    void Eeprom_Write_Float(unsigned int addr,float data1)
    {
          float temp_float;
          char *ptr;
          unsigned char i;

          temp_float=data1;
          ptr=&temp_float;
          for (i=0;i<4;i++){
                EEPROM_set(addr++,*(ptr++));
        }
    }
    --------------------------------------------------------------------------------

    Thanks.

     
    • Oliver Sedlacek

      Oliver Sedlacek - 2008-04-25

      What error message do you get from V2.8.0?

      I would certainly put an explicit cast in the source, i.e. change ptr=&temp_float; to ptr=(char *)&temp_float;

       
    • Huy Nguyen

      Huy Nguyen - 2008-05-05

      Thanks Oliver,

      The error message as the following from V2.8.0:
      ----------------------------------------------------------------------------
      ict.v1.00-eeprom.c:84: error 47: indirections to different types assignment
      from type 'float near* ' to type 'char generic* '
      ict.v1.00-eeprom.c:99: error 47: indirections to different types assignment
      from type 'float near* ' to type 'char generic* '
      ----------------------------------------------------------------------------

      I'll try to put an explicit cast as you suggest.

      Thanks with Best regards,
      Huy

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks