Search code examples
ctypescoding-style

Order of defining types


Is there any preference/convention/rule on order for defining a variable as static and long/double or other types?

e.g. is

static double a;

same as

double static a;

is it any different for functions? above, a is variable.


Solution

  • They are equivalent but static at the beginning is preferred.

    (C99, 6.11.5p1) "The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature"