Click here to Skip to main content
15,894,235 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionusing extern in C Pin
Sakhalean23-Jan-12 22:53
Sakhalean23-Jan-12 22:53 
AnswerRe: using extern in C Pin
Jochen Arndt23-Jan-12 23:09
professionalJochen Arndt23-Jan-12 23:09 
GeneralRe: using extern in C Pin
Sakhalean23-Jan-12 23:32
Sakhalean23-Jan-12 23:32 
GeneralRe: using extern in C Pin
Jochen Arndt23-Jan-12 23:41
professionalJochen Arndt23-Jan-12 23:41 
AnswerRe: using extern in C Pin
Erudite_Eric24-Jan-12 5:33
Erudite_Eric24-Jan-12 5:33 
AnswerRe: using extern in C Pin
Stefan_Lang24-Jan-12 5:50
Stefan_Lang24-Jan-12 5:50 
GeneralRe: using extern in C Pin
Erudite_Eric24-Jan-12 6:23
Erudite_Eric24-Jan-12 6:23 
GeneralRe: using extern in C Pin
Stefan_Lang24-Jan-12 22:44
Stefan_Lang24-Jan-12 22:44 
1. Yes and no. Syntacticaly you are correct. At least if you only have one .c file. But if you have more than one .c file, each file defines a local scope within the program. It's a wider scope than a function block or struct, but not as wide as a variable declared with 'extern' in a header.

2. Maybe. I am aware that many C program(mer)s like to use a lot of globals, and some mechanisms that make it easier to avoid globals in C++ are not available in C. Still, the problems caused by too many global variables is exactly the same in C as it is in C++. It's just that the effort to avoid them is on a different scale.

I've also noticed that long-time C programmers turning to C++ have a nasty habit to keep using lots of globals if there's no one around to keep them in check ('them' referring to both the globals and the programmers). Therefore I like to give out this advice to C and C++ programmers alike.
GeneralRe: using extern in C Pin
Erudite_Eric25-Jan-12 0:32
Erudite_Eric25-Jan-12 0:32 
AnswerRe: using extern in C Pin
«_Superman_»24-Jan-12 15:37
professional«_Superman_»24-Jan-12 15:37 
JokeRe: using extern in C Pin
Peter_in_278024-Jan-12 15:58
professionalPeter_in_278024-Jan-12 15:58 
GeneralRe: using extern in C Pin
Mohibur Rashid24-Jan-12 22:46
professionalMohibur Rashid24-Jan-12 22:46 
QuestionPlaying .wav file Pin
D.Manivelan23-Jan-12 19:33
D.Manivelan23-Jan-12 19:33 
AnswerRe: Playing .wav file Pin
PJ Arends23-Jan-12 19:49
professionalPJ Arends23-Jan-12 19:49 
GeneralRe: Playing .wav file Pin
D.Manivelan23-Jan-12 20:11
D.Manivelan23-Jan-12 20:11 
QuestionCustom drawn button inside the onInitDialog Pin
sdancer7523-Jan-12 8:47
sdancer7523-Jan-12 8:47 
AnswerRe: Custom drawn button inside the onInitDialog Pin
Albert Holguin23-Jan-12 9:20
professionalAlbert Holguin23-Jan-12 9:20 
GeneralRe: Custom drawn button inside the onInitDialog Pin
sdancer7523-Jan-12 20:55
sdancer7523-Jan-12 20:55 
AnswerRe: Custom drawn button inside the onInitDialog Pin
Albert Holguin24-Jan-12 5:09
professionalAlbert Holguin24-Jan-12 5:09 
GeneralRe: Custom drawn button inside the onInitDialog Pin
sdancer7524-Jan-12 21:34
sdancer7524-Jan-12 21:34 
QuestionCScrollView Pin
Bart23-Jan-12 7:21
Bart23-Jan-12 7:21 
AnswerRe: CScrollView Pin
Albert Holguin23-Jan-12 12:12
professionalAlbert Holguin23-Jan-12 12:12 
QuestionDisable OnFileOpen and OnFileSave in SDI Pin
_Flaviu23-Jan-12 5:15
_Flaviu23-Jan-12 5:15 
AnswerRe: Disable OnFileOpen and OnFileSave in SDI Pin
Jochen Arndt23-Jan-12 5:58
professionalJochen Arndt23-Jan-12 5:58 
AnswerRe: Disable OnFileOpen and OnFileSave in SDI Pin
Richard MacCutchan23-Jan-12 6:45
mveRichard MacCutchan23-Jan-12 6:45 

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.