Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualAnthony Serrano

Posted 29 April 2013 - 11:45 PM

Assuming C++ here.


A constant can become zero-storage but isn't guaranteed to be so. For example, if you take the address of a constant, it basically is just another variable except you can't write to it at compile-time (barring evil like const_cast).

UDTs can be compile-time constants, sure. But they won't ever be zero-storage because that doesn't quite make sense :-)

 

Also worth pointing out that in some cases a constant can't become zero-storage - the most obvious and frequently-encountered such example being string constants.

 

Got it.Thanks

So,do compile time constants disappear after the compilation?

 

That depends on what exactly you mean by "disappear".


#1Anthony Serrano

Posted 29 April 2013 - 11:27 PM

Assuming C++ here.


A constant can become zero-storage but isn't guaranteed to be so. For example, if you take the address of a constant, it basically is just another variable except you can't write to it at compile-time (barring evil like const_cast).

UDTs can be compile-time constants, sure. But they won't ever be zero-storage because that doesn't quite make sense :-)

Also worth pointing out that in some cases a constant can't become zero-storage - the most obvious and frequently-encountered such example being string constants.


PARTNERS