Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c    |    Meh, in C you gotta define EVERYTHING    |    243,242 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 241,953 of 243,242    |
|    Kenny McCormack to All    |
|    Attributes on functions/variables (stati    |
|    14 Nov 25 14:20:47    |
   
   From: gazelle@shell.xmission.com   
      
   Wow! An actual on-topic C question. Don't see much of that around here   
   these days...   
      
   My question has to do specifically with "static" - as seen below - but also   
   in general with these sorts of attributes of functions and variables.   
      
   Suppose I have code like this:   
      
   /* static */ char *foo(int);   
   int somefun(...) { code that uses foo() }   
   ...   
      
   static char *foo(int bar) { definition of foo() }   
      
   Is foo() static or not? Does the order matter? Suppose the first reference   
   to foo() had static and the second one didn't?   
      
   Or is it a syntax error to have different declarations/definitions like   
   this? What if they occur (as they usually will do) in different files (TUs) ?   
      
   Note that this came up in real life - I had to change a function that had   
   been static to non-static and was concerned about what would happen if I   
   didn't change it in every place. I didn't do much testing and decided to   
   post here instead.   
      
   --   
   On the subject of racism being depicted in the media, the far right and the   
   far left have   
   met up in agreement (sort of like how plus infinity meets up with minus   
   infinity).   
   The far left doesn't want it, because they are afraid it will make people   
   racist.   
   The far right doesn't want it, because they are afraid it will make people   
   feel bad about being racist.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca