Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: For loop Pin
trønderen2-Oct-23 8:01
trønderen2-Oct-23 8:01 
GeneralRe: For loop Pin
Randor 2-Oct-23 8:27
professional Randor 2-Oct-23 8:27 
GeneralRe: For loop Pin
trønderen2-Oct-23 12:17
trønderen2-Oct-23 12:17 
GeneralRe: For loop Pin
Randor 2-Oct-23 12:54
professional Randor 2-Oct-23 12:54 
GeneralRe: For loop Pin
trønderen2-Oct-23 21:11
trønderen2-Oct-23 21:11 
GeneralRe: For loop Pin
Randor 3-Oct-23 0:08
professional Randor 3-Oct-23 0:08 
GeneralRe: For loop Pin
trønderen3-Oct-23 9:54
trønderen3-Oct-23 9:54 
GeneralRe: For loop Pin
jschell3-Oct-23 4:35
jschell3-Oct-23 4:35 
trønderen wrote:
the C/C++ scoping/life time rules apply to the source code only and how it 'conceptually' is executed, and does not relate to the compiled code and how it actually runs.


Yep.

So as per the OP

"will allocate memory for an int every frame."

To me that is a question about how the compiler emitted code works and has nothing to do with the spec.

It seems to me to be obviously referring to the stack frame (emitted code.) And for comparison both parts of that are meaningless if the compiler emitted code uses a CPU register.

Compliance for the spec only applies to the 'scope' which means the visibility and the lifetime of the data.

Thus no one can use a compliant compiler and then complain when they attempt to circumvent the scope, for example by using a pointer. Because a compliant compiler can (but is not required) to reuse either a stack frame slot or a CPU register.

It is however possible to use a compliant compiler and deliberately circumvent the scope and it will work. At least for that compiler and that version of the compiler. Might even work in some cases in the same emitted binary and not others depending on how the compiler (not the spec) decides to optimize.
GeneralRe: For loop Pin
k505429-Sep-23 11:55
mvek505429-Sep-23 11:55 
GeneralRe: For loop Pin
Randor 29-Sep-23 12:14
professional Randor 29-Sep-23 12:14 
GeneralRe: For loop Pin
honey the codewitch3-Oct-23 12:32
mvahoney the codewitch3-Oct-23 12:32 
AnswerRe: For loop Pin
Dave Kreskowiak25-Sep-23 8:53
mveDave Kreskowiak25-Sep-23 8:53 
GeneralRe: For loop Pin
Calin Negru25-Sep-23 22:40
Calin Negru25-Sep-23 22:40 
GeneralRe: For loop Pin
Richard Andrew x6428-Sep-23 12:12
professionalRichard Andrew x6428-Sep-23 12:12 
GeneralRe: For loop Pin
Dave Kreskowiak28-Sep-23 12:20
mveDave Kreskowiak28-Sep-23 12:20 
GeneralRe: For loop Pin
harold aptroot26-Sep-23 15:15
harold aptroot26-Sep-23 15:15 
GeneralRe: For loop Pin
Calin Negru26-Sep-23 23:09
Calin Negru26-Sep-23 23:09 
GeneralRe: For loop Pin
harold aptroot5-Oct-23 21:32
harold aptroot5-Oct-23 21:32 
QuestionService not created correctly under windows 11 but any older version. Pin
Rick R. 202323-Sep-23 14:54
Rick R. 202323-Sep-23 14:54 
AnswerRe: Service not created correctly under windows 11 but any older version. Pin
Randor 23-Sep-23 10:43
professional Randor 23-Sep-23 10:43 
GeneralRe: Service not created correctly under windows 11 but any older version. Pin
Rick R. 202323-Sep-23 12:13
Rick R. 202323-Sep-23 12:13 
GeneralRe: Service not created correctly under windows 11 but any older version. Pin
Randor 23-Sep-23 12:22
professional Randor 23-Sep-23 12:22 
GeneralRe: Service not created correctly under windows 11 but any older version. Pin
Rick R. 202323-Sep-23 12:24
Rick R. 202323-Sep-23 12:24 
GeneralRe: Service not created correctly under windows 11 but any older version. Pin
Randor 23-Sep-23 12:53
professional Randor 23-Sep-23 12:53 
GeneralRe: Service not created correctly under windows 11 but any older version. Pin
Rick R. 202323-Sep-23 13:06
Rick R. 202323-Sep-23 13:06 

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.