I've inherited a legacy codebase. There's a C function declared in a header file alongside an enum:
Building the project I get the following warning:
From some googling, I've found some recommendations to declare the function as static inline instead. I've also seen that functions I know about such as NSMakeRange are declared with NSINLINE (omitting the underscore as it appears to break markdown on the forum), which appears to be a directive that does similar.
However if I change the signature to NSINLINE, the existing Unit Test fails - I can't figure out why, because setting a breakpoint in the function does not work.
So my question is - am I doing this right? I wondered if a I needed static at all, but if I don't include something I get linking errors.
Code Block //SomeFile.h typedef enum: NSUInteger { // cases declared } MyEnum; static NSString* StringForEnum(MyEnum enumType) { NSString *stringRep = nil switch(enumType) { // set stringRep to string depending on case } return stringRep; }
Building the project I get the following warning:
But it is used, in an Objective-C class and also in a Unit Test, which verifies that the switch statement returns the correct string.Unused function 'StringForEnum'
From some googling, I've found some recommendations to declare the function as static inline instead. I've also seen that functions I know about such as NSMakeRange are declared with NSINLINE (omitting the underscore as it appears to break markdown on the forum), which appears to be a directive that does similar.
However if I change the signature to NSINLINE, the existing Unit Test fails - I can't figure out why, because setting a breakpoint in the function does not work.
So my question is - am I doing this right? I wondered if a I needed static at all, but if I don't include something I get linking errors.