Top "Compile-time-constant" questions

Use this tag for questions related to the compile time constant, a constant value that is known at compile time.

Java switch statement: Constant expression required, but it IS constant

So, I am working on this class that has a few static constants: public abstract class Foo { ... public static final …

java compile-time-constant
M_PI flagged as undeclared identifier

When I compile the code below, I got these error messages: (Error 1 error C2065: 'M_PI' : undeclared identifier 2 IntelliSense: identifier "…

c++ development-environment compile-time-constant
How to declare a constant Guid in C#?

Is it possible to declare a constant Guid in C#? I understand that I can declare a static readonly Guid, …

c# constants guid compile-time-constant
Compile-time constants and variables

The Java language documentation says: If a primitive type or a string is defined as a constant and the value …

java performance constants final compile-time-constant
Constant expression contains invalid operations

I have the following code, where I get the error "PHP Fatal Error: Constant expression contains invalid operations". It works …

php class properties syntax-error compile-time-constant
Declare and initialize constant in header file

I'm well versed in the typical paradigm of: //.h extern const int myInt; //.c, .m, .cpp, what have you const …

c++ objective-c constants header-files compile-time-constant
Can I compute pow(10,x) at compile-time in c?

Is it possible to compute pow(10,x) at compile time? I've got a processor without floating point support and slow …

c compile-time-constant
error: initializer element is not a compile-time constant

I have been looking for answers but could not find anything to make this code run. I get av[1] highlighted …

c static compiler-errors initialization compile-time-constant
Defining colors as constants in C#

I've set up some default colors in a C# winforms application like so: readonly Color ERROR = Color.Red; readonly Color …

c# colors compile-time-constant
Constant expressions from an Enum

Is there any way of converting an enum into a constant expression? I want my switch operator to choose among …

java compile-time-constant