Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Static functions

Name: Anonymous 2009-06-29 11:31

I've been using a lot of them recently. I find it streamlines my code, are there any drawbacks from using them?

Name: Anonymous 2009-06-29 17:02

>>1
Hey, OP, stop reading this bunch of idiots here and listen: static functions are good! I suppose you are writing C, so you don't have C++ namespace. This makes the thing worst, since all exported functions should be declared with some kind of prefix.

Static functions have no drawbacks at all, and they can just be used inside the module. Even better: nobody prevents you to pass them as function pointers, so you can implement even callbacks as static!

Just avoid declaring static variables: your code won't be reentrant anymoar, and you'll need mutexes if your code is multithreaded. You shouldn't either think your code will never be multithreaded, so don't give static variable a crap, ok?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List