Click here to Skip to main content
15,919,028 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Question about the font in PDF Pin
Bosicat7-Jul-03 16:56
Bosicat7-Jul-03 16:56 
GeneralService Pack Pin
Member 4242597-Jul-03 3:32
Member 4242597-Jul-03 3:32 
GeneralRe: Service Pack Pin
John M. Drescher7-Jul-03 3:47
John M. Drescher7-Jul-03 3:47 
GeneralRe: Service Pack Pin
Michael Dunn7-Jul-03 17:34
sitebuilderMichael Dunn7-Jul-03 17:34 
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 
Terminology, terminology, terminology ...

In C, I have always seen "global" variables created in one of the source files and then all other source files that want access to that global variable use "extern". I have seen some people create those global variables in header files an use tricks with #define and #ifdef, but those end up being just tricks and overly complicate the simple concept that is being implemented.

As for functions, you can write a function and any source file can have access to that function as long as it includes the header file. Okay, go ahead, call these "global" functions.

In C, though, when you use "static" on a function or variable, this is supposed to mean that the function or variable is only visible within that single file.

Therefore, it would be impossible to have a "static global" function or variable, because to be "global" means everything can see it and to be "static" means it is only visible in the file where it is written.

Now, in C++, static functions and variables really belong to the "class" and not to the instantiations of the class. When dealing with "class" variables (as opposed to "member" variables) it also become difficult to think of these being "global." In C++, I have always seen "global" functions and variables to be declared outside of any class.

As for speed, I think this is a moot point, because those declarations affect visibility and access from other code elements and not the final implementation and conversion into executable code. An address of a function must still be known, obtained, and accessed regardless of whether the function is global, static, or something else.

Dave

"You can say that again." -- Dept. of Redundancy Dept.
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 
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 

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.