Click here to Skip to main content
15,914,016 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGlobal vs local variables Pin
rajeevktripathi5-Sep-07 0:50
rajeevktripathi5-Sep-07 0:50 
AnswerRe: Global vs local variables Pin
Waldermort5-Sep-07 0:52
Waldermort5-Sep-07 0:52 
QuestionRe: Global vs local variables Pin
rajeevktripathi5-Sep-07 0:58
rajeevktripathi5-Sep-07 0:58 
AnswerRe: Global vs local variables Pin
Waldermort5-Sep-07 1:10
Waldermort5-Sep-07 1:10 
QuestionRe: Global vs local variables Pin
rajeevktripathi5-Sep-07 1:38
rajeevktripathi5-Sep-07 1:38 
AnswerRe: Global vs local variables Pin
jhwurmbach5-Sep-07 2:22
jhwurmbach5-Sep-07 2:22 
AnswerRe: Global vs local variables Pin
Naveen5-Sep-07 2:13
Naveen5-Sep-07 2:13 
AnswerRe: Global vs local variables Pin
David Crow5-Sep-07 4:53
David Crow5-Sep-07 4:53 
rajeevktripathi wrote:
why global variables are initialized to zero whereas local variables are not...


You'll likely see a difference in initialization between release and debug compiles of your program. In debug mode, since the frame pointer is always pushed onto the stack at routine entry, variables are almost always assigned locations on the stack (e.g., 0). In the release mode, optimizations of the compiler (and other factors) may detect that the frame pointer is not needed, so the frame pointer is not pushed onto the stack, thus no initial value.


"A good athlete is the result of a good and worthy opponent." - David Crow

"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne


QuestionReader Writer lock Pin
Waldermort5-Sep-07 0:50
Waldermort5-Sep-07 0:50 
AnswerRe: Reader Writer lock Pin
chandu0045-Sep-07 1:42
chandu0045-Sep-07 1:42 
AnswerRe: Reader Writer lock Pin
Matthew Faithfull5-Sep-07 1:52
Matthew Faithfull5-Sep-07 1:52 
GeneralRe: Reader Writer lock Pin
Waldermort5-Sep-07 2:44
Waldermort5-Sep-07 2:44 
GeneralRe: Reader Writer lock Pin
El Corazon5-Sep-07 5:02
El Corazon5-Sep-07 5:02 
GeneralRe: Reader Writer lock Pin
El Corazon5-Sep-07 5:34
El Corazon5-Sep-07 5:34 
GeneralRe: Reader Writer lock Pin
Waldermort5-Sep-07 6:17
Waldermort5-Sep-07 6:17 
GeneralRe: Reader Writer lock Pin
El Corazon5-Sep-07 7:38
El Corazon5-Sep-07 7:38 
GeneralRe: Reader Writer lock Pin
Matthew Faithfull5-Sep-07 5:49
Matthew Faithfull5-Sep-07 5:49 
GeneralRe: Reader Writer lock Pin
Waldermort5-Sep-07 6:15
Waldermort5-Sep-07 6:15 
AnswerRe: Reader Writer lock Pin
Matthew Faithfull5-Sep-07 6:28
Matthew Faithfull5-Sep-07 6:28 
GeneralRe: Reader Writer lock Pin
El Corazon5-Sep-07 7:42
El Corazon5-Sep-07 7:42 
GeneralRe: Reader Writer lock Pin
Matthew Faithfull5-Sep-07 9:30
Matthew Faithfull5-Sep-07 9:30 
GeneralRe: Reader Writer lock Pin
El Corazon5-Sep-07 9:52
El Corazon5-Sep-07 9:52 
QuestionA very basic question Pin
HakunaMatada5-Sep-07 0:24
HakunaMatada5-Sep-07 0:24 
AnswerRe: A very basic question Pin
Matthew Faithfull5-Sep-07 0:47
Matthew Faithfull5-Sep-07 0:47 
AnswerRe: A very basic question Pin
Waldermort5-Sep-07 0:58
Waldermort5-Sep-07 0:58 

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.