Static Functions | C Programming Tutorial

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Another nice video, thanks. The doubt the stood in my mind is that if we change the effect of the function in the interface, in the example report_value wouldn't you still risk to break the program because even though the function signature did not change the effect (could be the return value) did change. I thought that we could change the static print but without affecting the return value or effect for the interface function otherwise the change would have to be communicated to all users of the interface I assume.

vicsteiner
Автор

Hi, awesome subject. In a more advanced way, the static function doesn't have the name (string) in the binary's symbol table. The compiled code is still there and can be called directly, let's say, in the main() by the function address (using function pointer), but not by the function name. Unfortunately, you need to discover the address of the static function somehow.

fuscatube
Автор

If they limit the scope making it "private" to the translation unit why do we even need header files (for documentation purposes?)
When I don't include a header file I can still use non-static functions defined in the other file (even though I get an implicit declaration warning)

beegdigit
Автор

Sir, can you make an example of how to do a unity build of multiple files?

gammyhorse
Автор

Is it usefull for when creating a sort library in which there is a global sort function and bunch of static sort functions that implement a specific sort algorithm and are called within the non-static sort function? If yes, how could the user specify the sort algorithm as an argument that points to those static functions?

reverseila
Автор

They should have used private instead of static.

egonkirchof