Find the answer to your Linux question:
Results 1 to 3 of 3
Hi all, I have come across a code in which a static variabe is declared as int static i; Now the compiler gives a warning that : "Storage class defined ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2005
    Location
    India
    Posts
    5

    Is there any difference between "int static i" and "static int i"


    Hi all,

    I have come across a code in which a static variabe is declared as

    int static i;

    Now the compiler gives a warning that : "Storage class defined before acess specifier".
    So is there any differrence between
    int static i; and
    static int i;

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,929
    Yes, the difference is that one is right and one is wrong. The compiler can handle it (hence the warning not the error), but in general the storage class should come first.

    static int i;

    or even

    static const char * const str;
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Just Joined!
    Join Date
    Aug 2005
    Location
    India
    Posts
    5
    Thanks for the answer.

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •