I recently inherited some older C code and saw something I haven't really
seen before. I noticed it as it fails to compile at my home computer, as it
has a newer (4.x vs 3.x ) gcc compiler.
Its a private function, inside a function. Something like this.
void myFunc(...) {
static void myPrivateFunc(. ..) {
}
...
return;
}
I assume its failing to compile, because the private function is declared
static. I guess what I'm comfused at is I havent' really seen functions
declared in functions before. Could this have been done for performance
reasons or something? The original author has about 5 different C files,
each with one of these private functions, they all do about the same thing.
There basically some masking and quit math on the function parameters.
I'm just wondering if its performance as this is some intensive data
decoding code. Mucking with lots of data at the bit per bit level.
seen before. I noticed it as it fails to compile at my home computer, as it
has a newer (4.x vs 3.x ) gcc compiler.
Its a private function, inside a function. Something like this.
void myFunc(...) {
static void myPrivateFunc(. ..) {
}
...
return;
}
I assume its failing to compile, because the private function is declared
static. I guess what I'm comfused at is I havent' really seen functions
declared in functions before. Could this have been done for performance
reasons or something? The original author has about 5 different C files,
each with one of these private functions, they all do about the same thing.
There basically some masking and quit math on the function parameters.
I'm just wondering if its performance as this is some intensive data
decoding code. Mucking with lots of data at the bit per bit level.
Comment