gcc - C - Mismatched function prototype and definition for "static" function -


i trying find official confirmation on theory respect c functions. in simple project of mine, have function want visible within .c file in defined. function prototype is:

static int sum(int a, int b); 

the function definition is:

int sum(int a, int b) {    return (a+b); } 

upon analysis of build output, link maps, etc, seems function indeed static. i'm surprised don't build warnings or errors either. however, there in terms of documentation (ie: specific line in gcc manual) can confirm behavior, or expected?

i have found equivalent of question c++ (static keyword in function declaration can missing in function definition?), looking answer respect pure c.

thank you.

you can download full specification http://www.iso.org/iso/home/store/catalogue_ics/catalogue_detail_ics.htm?csnumber=57853

for 238 swiss francs, , i'm sure have answer. otherwise, best source have "the c programming language" 2nd edition k&r, section 4.6 on page 83 (emphasis added)

"the external static declaration used variables, can applied functions well. normally, function names global, visible part of entire program. if function declared static, however, name invisible outside of file in declared."

note quote refers declaration of function, not definition, although it's common practice static functions, definition serves declaration well.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -