static void

Started by
2 comments, last by icecubeflower 16 years, 2 months ago
Hey I used to have a little function that was called all the time so I made it static static void setfy(); which I thought meant that the function is always loaded in memory so it's faster. But my main program was getting huge so I split it up into lots of .h and .cpp files and I put setfy() into a .h and .cpp file and then when I try to compile it says /home/icecube/project5/src/orient.h:39: error: 'void setfy()' used but never defined What does that mean? To make it work I have to make it a regular function but I think I want to make it static.
Advertisement
static doesn't seem to mean what you think it does. Applied to non-member functions it means that the function has internal linkage. Internal linkage, in turn, more or less means that the definition isn't visible outside the source file it's defined in. Solution: take off the static.
Any function that's used often will stay in memory all the time without you needing to specify anything.
Sweet. Thanks.

This topic is closed to new replies.

Advertisement