Click here to Skip to main content
15,798,278 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: For loop Pin
Randor 25-Sep-23 6:36
professional Randor 25-Sep-23 6:36 
GeneralRe: For loop Pin
jschell25-Sep-23 8:25
jschell25-Sep-23 8:25 
QuestionRe: For loop Pin
Randor 25-Sep-23 8:48
professional Randor 25-Sep-23 8:48 
AnswerRe: For loop Pin
jschell26-Sep-23 6:10
jschell26-Sep-23 6:10 
GeneralRe: For loop Pin
Randor 26-Sep-23 6:38
professional Randor 26-Sep-23 6:38 
GeneralRe: For loop Pin
jschell27-Sep-23 6:23
jschell27-Sep-23 6:23 
JokeRe: For loop Pin
Randor 27-Sep-23 7:57
professional Randor 27-Sep-23 7:57 
GeneralRe: For loop Pin
trønderen28-Sep-23 14:50
trønderen28-Sep-23 14:50 
I'm still not clear about this.

If variables X and Y are defined in a block, must they both be available throughout the lifetime of that block?

If the compiler does a complete flow analysis, detecting that variable X is only used in the first half of the code, and variable Y only in the second half, with no overlapping use possible for any possible execution path, can then X and Y share the space?

For the running code, sharing would be OK. A debugger might display both X and Y as soon as the block is entered, and all the time until the block is left. If X and Y share a location, then Y would be incorrectly displayed for the first half, X for the second half. Does anything in the C++ standard forbid this? Does the language standard at all relate to tools like debuggers, or only to the executing program code itself?
GeneralRe: For loop Pin
jschell29-Sep-23 12:07
jschell29-Sep-23 12:07 
GeneralRe: For loop Pin
trønderen29-Sep-23 12:35
trønderen29-Sep-23 12:35 
GeneralRe: For loop Pin
Randor 29-Sep-23 13:04
professional Randor 29-Sep-23 13:04 
GeneralRe: For loop Pin
jschell2-Oct-23 6:09
jschell2-Oct-23 6:09 
GeneralRe: For loop Pin
Randor 2-Oct-23 6:47
professional Randor 2-Oct-23 6:47 
GeneralRe: For loop Pin
trønderen2-Oct-23 9:01
trønderen2-Oct-23 9:01 
GeneralRe: For loop Pin
Randor 2-Oct-23 9:27
professional Randor 2-Oct-23 9:27 
GeneralRe: For loop Pin
trønderen2-Oct-23 13:17
trønderen2-Oct-23 13:17 
GeneralRe: For loop Pin
Randor 2-Oct-23 13:54
professional Randor 2-Oct-23 13:54 
GeneralRe: For loop Pin
trønderen2-Oct-23 22:11
trønderen2-Oct-23 22:11 
GeneralRe: For loop Pin
Randor 3-Oct-23 1:08
professional Randor 3-Oct-23 1:08 
GeneralRe: For loop Pin
trønderen3-Oct-23 10:54
trønderen3-Oct-23 10:54 
GeneralRe: For loop Pin
jschell3-Oct-23 5:35
jschell3-Oct-23 5:35 
GeneralRe: For loop Pin
k505429-Sep-23 12:55
mvek505429-Sep-23 12:55 
GeneralRe: For loop Pin
Randor 29-Sep-23 13:14
professional Randor 29-Sep-23 13:14 
GeneralRe: For loop Pin
honey the codewitch3-Oct-23 13:32
mvahoney the codewitch3-Oct-23 13:32 
AnswerRe: For loop Pin
Dave Kreskowiak25-Sep-23 9:53
mveDave Kreskowiak25-Sep-23 9:53 

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.