Click here to Skip to main content
15,908,166 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralQuestion about global static function and global static variable. Pin
George27-Jul-03 3:23
George27-Jul-03 3:23 
GeneralRe: Question about global static function and global static variable. Pin
AlexO7-Jul-03 3:37
AlexO7-Jul-03 3:37 
GeneralRe: Question about global static function and global static variable. Pin
George27-Jul-03 3:41
George27-Jul-03 3:41 
GeneralRe: Question about global static function and global static variable. Pin
David Chamberlain7-Jul-03 4:06
David Chamberlain7-Jul-03 4:06 
GeneralRe: Question about global static function and global static variable. Pin
John M. Drescher7-Jul-03 3:52
John M. Drescher7-Jul-03 3:52 
GeneralRe: Question about global static function and global static variable. Pin
George27-Jul-03 4:01
George27-Jul-03 4:01 
GeneralRe: Question about global static function and global static variable. Pin
John M. Drescher7-Jul-03 7:56
John M. Drescher7-Jul-03 7:56 
GeneralRe: Question about global static function and global static variable. Pin
Ryan Binns7-Jul-03 4:23
Ryan Binns7-Jul-03 4:23 
The static keyword only affects the visibility of a function or variable - a static function/variable can only be used within the file in which it is defined. There is no difference in terms of speed. The only limitation is that you can't use them from multiple files. No function is thread-safe unless you make it so, by programming safely. static variables are no different to global variables in this respect - remember that static only affects which part of the program can access them. Once you compile the code, there is no different between using static and not using it.

Generally, using static is a good thing, because it provides more information about where the function is used - it helps maintenance programmers who may have to look at the code later, and tells them that the function/variable is only used within the one file.

Hope this helps,

Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

GeneralRe: Question about global static function and global static variable. Pin
basementman7-Jul-03 5:04
basementman7-Jul-03 5:04 
GeneralRe: Question about global static function and global static variable. Pin
Ryan Binns7-Jul-03 5:12
Ryan Binns7-Jul-03 5:12 
GeneralRe: Question about global static function and global static variable. Pin
basementman7-Jul-03 5:20
basementman7-Jul-03 5:20 
GeneralRe: Question about global static function and global static variable. Pin
Ryan Binns7-Jul-03 5:24
Ryan Binns7-Jul-03 5:24 
GeneralRe: Question about global static function and global static variable. Pin
John R. Shaw7-Jul-03 9:31
John R. Shaw7-Jul-03 9:31 
GeneralStoring Images into Oracle as Blob From VC++ Or MFC Pin
Shaffiq7-Jul-03 2:41
Shaffiq7-Jul-03 2:41 
GeneralRe: Storing Images into Oracle as Blob From VC++ Or MFC Pin
John M. Drescher7-Jul-03 3:23
John M. Drescher7-Jul-03 3:23 
GeneralCRichEdit & SetWindowText Pin
AnTri7-Jul-03 1:16
AnTri7-Jul-03 1:16 
GeneralRe: CRichEdit & SetWindowText Pin
David Crow7-Jul-03 2:40
David Crow7-Jul-03 2:40 
GeneralRe: CRichEdit & SetWindowText Pin
AnTri7-Jul-03 8:41
AnTri7-Jul-03 8:41 
GeneralRe: CRichEdit & SetWindowText Pin
David Crow7-Jul-03 10:15
David Crow7-Jul-03 10:15 
Generaldebugging Opengl with MFC 6.0 Pin
kassad6667-Jul-03 0:00
kassad6667-Jul-03 0:00 
GeneralRe: debugging Opengl with MFC 6.0 Pin
Rage7-Jul-03 0:49
professionalRage7-Jul-03 0:49 
GeneralRe: debugging Opengl with MFC 6.0 Pin
Anonymous7-Jul-03 4:50
Anonymous7-Jul-03 4:50 
GeneralRe: debugging Opengl with MFC 6.0 Pin
Rage7-Jul-03 5:27
professionalRage7-Jul-03 5:27 
GeneralWM_PRINTCLIENT message Pin
peenu6-Jul-03 23:32
peenu6-Jul-03 23:32 
GeneralRe: WM_PRINTCLIENT message Pin
Ryan Binns6-Jul-03 23:37
Ryan Binns6-Jul-03 23:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.