#83 Local, static variables and mem-modifier

closed-out-of-date
nobody
5
2013-05-25
2001-06-27
No

f2 (char c) { c; }

f () reentrant
{
code char c1 = 'J';
static code char c2 = 'K';
static idata char c3;
static xdata char c4;
static data char c5;

f2 (c1);
f2 (c2);
f2 (c3);
f2 (c4);
f2 (c5);
}

warning *** storage class not allowed for automatic
variable 'c1' in reentrant function
warning *** storage class not allowed for automatic
variable 'c2' in reentrant function
warning *** storage class not allowed for automatic
variable 'c3' in reentrant function
warning *** storage class not allowed for automatic
variable 'c4' in reentrant function
warning *** storage class not allowed for automatic
variable 'c5' in reentrant function
warning *** 'auto' variable 'c1' may be used before
initialization at

1. It should be possible to assign any storage class
to a static variable.
2. IMHO "code" should imply "static", so that it's not
an auto variable.
3. the last warning is wrong: c1 is initialized.
4. c1 is allocate in a register
5. c2...c4 are allocated in DSEG

Bernhard

Discussion

  • Bernhard Held

    Bernhard Held - 2001-07-02

    Logged In: YES
    user_id=203539

    Great fix ;-) The good news: the warning has gone. The bad
    news: I've got an error:

    >error *** storage class not allowed for automatic
    variable 'str' in reentrant function unless static

    typedef struct
    {
    char code *str;
    char idata i;
    char data d;
    } STRUCT;

    static STRUCT s;

     
  • Johan Knol

    Johan Knol - 2001-07-14

    Logged In: YES
    user_id=63512

    This seems to be fixed now, isn't it?

     
  • Johan Knol

    Johan Knol - 2001-07-14

    Logged In: YES
    user_id=63512

    This seems to be fixed now, isn't it?

     
  • Johan Knol

    Johan Knol - 2001-07-14

    Logged In: YES
    user_id=63512

    This seems to be fixed now, isn't it?

     
  • Johan Knol

    Johan Knol - 2001-08-23
    • milestone: --> unreproducable
    • status: open --> closed-out-of-date
     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks