Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about static-variables

Read more about static-variables

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - static-variables

Optimizing away static variable / passing by reference

In this question Will a static variable always use up memory? it is stated that compilers are allowed to optimize away a static variable if the address is never taken, e.g. like following: void f() { ...
test-img

tommsch

c++

pass-by-reference

compiler-optimization

static-variables

Votes: 0

Answers: 2

Latest Answer

that compilers are allowed to optimize away a static variable if the address is never taken You seem to concentrated on the wrong part of the answer. The answer states: the compiler can do anything...
test-img

KamilCuk

c programming using a static variable and then pointing to it ? possible?

In c when creating and returning the address in a static variable inside a function would it be the same as initializing a simple int sNum2 = 0 ; int * temp = &sNum2; ? static will basically have ...
test-img

user14570759

c

function

pointers

memory-address

static-variables

Votes: 0

Answers: 3

Latest Answer

This is valid code. A static variable, whether declared at file scope or inside of a function, has full program lifetime. That means its address will always be valid and can be safely dereferenced at...
test-img

dbush

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved