Gang Of Coders
Home
About Us
Contact Us
All Constants Solutions on Gang of Coders
Total of 237 Constants Solutions
What is the difference between #define and const?
C++
Constants
C Preprocessor
When would I use std::integral_constant over constexpr?
C++
Templates
C++11
Constants
Constexpr
What does the constant 0.0039215689 represent?
C
Floating Point
Constants
Magic Numbers
Defining Local Variable const vs Class const
C#
.Net
Constants
Jit
Is there const in C?
C++
C
Constants
Language Comparisons
How to create Javascript constants as properties of objects using const keyword?
Javascript
Object
Properties
Constants
How extract private static constant in Intellij Idea?
Java
Intellij Idea
Refactoring
Keyboard Shortcuts
Constants
Interpolate a constant (not variable) into 'heredoc'
Php
Syntax
Constants
Heredoc
Is it possible to define a class constant inside an Enum?
Python
Python 3.x
Enums
Constants
Class Constants
Is it better to remove "const" in front of "primitive" types used as function parameters in the header?
C++
Header
Constants
Primitive Types
Initialization of a constant reference with a number
C++
Reference
Constants
Rvalue Reference
Static Constants in C#
C#
String
Constants
Do you use constants from the implementation in your test cases?
Unit Testing
Constants
How do I create a constant in Python?
Python
Constants
Constants in Kotlin -- what's a recommended way to create them?
Kotlin
Constants
How to declare a class instance as a constant in C#?
C#
.Net
Constants
Proper use of const for defining functions
Javascript
Function
Constants
Ecmascript 6
Are there any downsides to marking all variables you don't modify const?
C++
Refactoring
Constants
Why can const char* const & = "hello" compile?
C++
Reference
Constants
Language Lawyer
Type-inferring a constant in C#
C#
Constants
Type Inference
Compile-time constants and variables
Java
Performance
Constants
Final
Compile Time-Constant
How do I remove code duplication between similar const and non-const member functions?
C++
Class
Constants
Code Duplication
C++ Faq
Initialize multiple constant class members using one function call C++
C++
Oop
Constructor
Constants
Initializer List
Constants or class variables in ruby?
Ruby
Constants
Class Variables
Direct array initialization with a constant value
C#
Arrays
Initialization
Constants
Can global constants be declared in JavaScript?
Javascript
Variables
Constants
Global Variables
constant already defined in php
Php
Constants
const vector implies const elements?
C++
Constants
Differences Between vbLf, vbCrLf & vbCr Constants
vb.net
Printing
Constants
Msgbox
How to have abstract and overriding constants in C#?
C#
Polymorphism
Constants
Can I use string concatenation to define a class CONST in PHP?
Php
Class
Constants
PHP Class Constants - Public, Private or Protected?
Php
Constants
Return reference to a vector member variable
C++
Vector
Reference
Constants
what is the reason for explicitly declaring L or UL for long values
C
Constants
How can I get the size of an std::vector as an int?
C++
Vector
Size
Constants
Unsigned Integer
Are there constants in JavaScript?
Javascript
Constants
static const vs #define
C++
C
Constants
How come a non-const reference cannot bind to a temporary object?
C++
Reference
Constants
Temporary
C++ Faq
Constants in Objective-C
Ios
Objective C
Cocoa
Nsstring
Constants
How to convert a std::string to const char* or char*
C++
String
Char
Constants
Difference between char* and const char*?
C
Pointers
Constants
Ruby on Rails: Where to define global constants?
Ruby on-Rails
Constants
Global
Constant pointer vs Pointer to constant
C
Pointers
Constants
Is it better in C++ to pass by value or pass by constant reference?
C++
Variables
Pass by-Reference
Constants
Pass by-Value
Declare a constant array
Arrays
Go
Constants
How to select multiple rows filled with constants?
Sql
Select
Constants
Why isn't String.Empty a constant?
.Net
String
Readonly
Constants
Include constant in string without concatenating
Php
String
Constants
Concatenation
What is the temporal dead zone?
Javascript
Ecmascript 6
Constants
Let
Meaning of 'const' last in a function declaration of a class?
C++
Constants
Declaration
C++ Faq
What does the PHP error message "Notice: Use of undefined constant" mean?
Php
Constants
Undefined
PHP 5: const vs static
Php
Object
Constants
Class Design
Static Members
How can I get all constants of a type by reflection?
C#
.Net
Reflection
Constants
C++: const reference, before vs after type-specifier
C++
Reference
Constants
How can I get a resource content from a static context?
Java
Android
Static
Constants
Android Resources
Why can I change a constant object in javascript
Javascript
Ecmascript 6
Constants
How to sort with a lambda?
C++
Sorting
Lambda
Char
Constants
Const before or const after?
C++
C
Syntax
Constants
What's the difference between constexpr and const?
C++
C++11
Constants
Constexpr
Go naming conventions for const
Go
Constants
Naming Conventions
What is the difference between const_iterator and non-const iterator in the C++ STL?
C++
Stl
Iterator
Constants
How can I specify a [DllImport] path at runtime?
C#
C++
Dll
Constants
Dllimport
What is the best way to create constants in Objective-C
Objective C
Constants
PHP | define() vs. const
Php
Variables
Constants
Psr 1
Psr 12
Accessing a class's constants
Ruby on-Rails
Ruby
Constants
Java's final vs. C++'s const
Java
C++
Constants
Final
Purpose of returning by const value?
C++
Constants
Class constants in python
Python
Constants
What's the point of const pointers?
C++
C
Pointers
Constants
Can I get CONST's defined on a PHP class?
Php
Constants
Class Constants
constant pointer vs pointer on a constant value
C
Pointers
Constants
What is meant with "const" at end of function declaration?
C++
Constants
Why is there no Constant feature in Java?
Java
Constants
Final
Creating a constant Dictionary in C#
C#
.Net
Collections
Dictionary
Constants
What is the use of interface constants?
Java
Interface
Constants
How many and which are the uses of "const" in C++?
C++
Constants
Javascript (ES6) const with curly braces
Javascript
Ecmascript 6
Constants
Elegant solution to duplicate, const and non-const, getters?
C++
Constants
"static const" vs "#define" vs "enum"
C
Constants
How do I turn off PHP Notices?
Php
Error Handling
Constants
C++ where to initialize static const
C++
Static
Initialization
Constants
Why can't I initialize non-const static member or static array in class?
C++
Static
Constants
Difference between `const shared_ptr<T>` and `shared_ptr<const T>`?
C++
Boost
Constants
Shared Ptr
How to initialize const member variable in a class?
C++
Constants
Does PowerShell support constants?
Powershell
Constants
C++ map access discards qualifiers (const)
C++
Stl
Constants
Maps
What's the best practice to keep all the constants in Flutter?
Static
Dart
Flutter
Constants
'const int' vs. 'int const' as function parameters in C++ and C
C++
C
Constants
const before parameter vs const after function name c++
C++
Function
Constants
Const map element access
C++
Dictionary
Stl
Constants
Does const mean thread-safe in C++11?
C++
C++11
Thread Safety
Constants
C++ Faq
How to initialize a private static const map in C++?
C++
Static
Map
Initialization
Constants
Declare a const array
C#
.Net
Arrays
Constants
Readonly
Storing integer values as constants in Enum manner in java
Java
Enums
Constants
v8 JavaScript performance implications of const, let, and var?
Javascript
Performance
Constants
V8
Let
Assigning a variable NaN in python without numpy
Python
Constants
Nan
What is the difference between char s[] and char *s?
C
String
Char
Constants
Why Is `Export Default Const` invalid?
Javascript
Scope
Export
Constants
Default
Importing a long list of constants to a Python file
Python
Constants
Python Import
Overriding class constants vs properties
Php
Oop
Inheritance
Overriding
Constants
What's the best way to store a group of constants that my program uses?
C#
Constants
Where to store global constants in an iOS application?
Ios
Objective C
Cocoa Touch
Constants
Global
How to use Swift struct in Objective-C
Objective C
Swift
Constants
C++0x lambda capture by value always const?
C++
Lambda
Constants
C++11
Pros and Cons of Interface constants
Php
Interface
Constants
What is the difference between a const reference and normal parameter?
C++
Parameters
Reference
Constants
Why is argc not a constant?
C++
Constants
Main
Argc
Effective C++
How to reference constants in EL?
Jsp
Constants
El
Do rvalue references to const have any use?
C++
C++11
Constants
Rvalue Reference
C++ Const Usage Explanation
C++
Constants
This source code is switching on a string in C. How does it do that?
C
Switch Statement
Label
Constants
Naming convention for Scala constants?
Scala
Naming Conventions
Constants
Which is best way to define constants in android, either static class, interface or xml resource?
Android
Xml
Configuration
Constants
Static Members
Static constant string (class member)
C++
String
Class
Static
Constants
Why isn't the [] operator const for STL maps?
C++
Constants
C# naming convention for constants?
C#
Naming Conventions
Constants
How to declare string constants in JavaScript?
Javascript
Constants
Deleting a pointer to const (T const*)
C++
Constants
Delete Operator
Use of 'const' for function parameters
C++
Constants
What is the best practice for adding constants in laravel? (Long List)
Php
Laravel
Laravel 5
Constants
Laravel 5.3
Why catch an exception as reference-to-const?
C++
Exception
Constants
What is the difference between static const and const?
C
Static
Constants
does `const auto` have any meaning?
C++
C++11
Constants
Define constant variables in C++ header
C++
Header
Constants
Swift constants: Struct or Enum
Swift
Struct
Enums
Constants
Isn't "const" redundant when passing by value?
C++
Constants
Pass by-Value
Time consts in Java?
Java
Date
Time
Constants
PHP - define constant inside a class
Php
Class
Constants
Does C++11 allow vector<const T>?
C++
Vector
C++11
Constants
ECMAScript 2015: const in for loops
Javascript
For Loop
Scope
Constants
Ecmascript 6
Is 'auto const' and 'const auto' the same?
C++
C++11
Language Lawyer
Constants
Auto
How can I portably call a C++ function that takes a char** on some platforms and a const char** on others?
C++
Constants
Portability
Can parameters be constant?
C#
Constants
Readonly
Parameter Passing
What is the best way to define log TAG constant in Kotlin?
Java
Android
Kotlin
Constants
Variably modified array at file scope
C
Objective C
Arrays
Static
Constants
Advantages of using const instead of variables inside methods
C#
Coding Style
Resharper
Constants
What is the difference between immutable and const variables in Rust?
Rust
Constants
Immutability
Pedantic gcc warning: type qualifiers on function return type
C++
Constants
Gcc Warning
Why are references not "const" in C++?
C++
Reference
Constants
Language Lawyer
Decltype
Why can a const member function modify a static data member?
C++
Function
C++11
Static
Constants
PHP Constants Containing Arrays?
Php
Arrays
Constants
Scalar
Keyword 'const' does not make the value immutable. What does it mean?
Javascript
Ecmascript 6
Constants
What is the difference between a static and const variable?
C++
C
Static
Constants
Check if a constant is already defined
Ruby
Constants
Dynamic constant name in PHP
Php
Constants
Indirection
Dynamic constant name in PHP
Php
Constants
Indirection
C++ style cast from unsigned char * to const char *
C++
Constants
Casting
What is the meaning of a const at end of a member function?
C++
Constants
const char* and char const* - are they the same?
C++
Pointers
Constants
#define vs const in Objective-C
Objective C
Constants
C Preprocessor
How to make a for loop variable const with the exception of the increment statement?
C++
Algorithm
For Loop
Variables
Constants
Unable to free const pointers in C
C
Constants
Free
How to initialize a const field in constructor?
C++
Constructor
Constants
Ctor Initializer
Does const-correctness give the compiler more room for optimization?
C++
C
Pointers
Constants
Const Correctness
solutions to the annoying "warning: already initialized constant" message
Ruby
Constants
How to check if a defined constant exists in PHP?
Php
If Statement
Constants
Fuelphp
Why is a const variable sometimes not required to be captured in a lambda?
C++
Lambda
Constants
Language Lawyer
What is the difference between const int*, const int * const, and int const *?
C++
C
Pointers
Constants
C++ Faq
Why can't I have "public static const string S = "stuff"; in my Class?
C#
Constants
const& , & and && specifiers for member functions in C++
C++
C++11
Constants
React create constants file
Javascript
Reactjs
Constants
const vs constexpr on variables
C++
Variables
C++11
Constants
Constexpr
What is the difference between "const" and "val"?
Constants
Kotlin
Accessing a class constant using a simple variable which contains the name of the constant
Php
Class
Variables
Constants
What is the use of "static" keyword if "let" keyword used to define constants/immutables in swift?
Swift
Static
Constants
What is the purpose of Decimal.One, Decimal.Zero, Decimal.MinusOne in .Net
C#
.Net
vb.net
Decimal
Constants
Returning a const reference to an object instead of a copy
C++
Constants
How to declare a constant in Java?
Java
Constants
How to define static constants in a Java enum?
Java
Enums
Constants
What is the use of const overloading in C++?
C++
Function
Constants
Overloading
Where to declare/define class scope constants in C++?
C++
Constants
Declaration
Mixing extern and const
C++
C
Constants
Scope
Extern
Const in JavaScript: when to use it and is it necessary?
Javascript
node.js
Constants
Immutability
const to Non-const Conversion in C++
C++
Constants
Why doesn't PHP permit private const?
Php
Oop
Constants
Private
Encapsulation
What is a constant reference? (not a reference to a constant)
C++
Reference
Constants
Why would you use the keyword const if you already know variable should be constant?
C++
C
Constants
Keyword
What is the difference between the "const" and "final" keywords in Dart?
Dart
Constants
Keyword
Final
Why does JSHint throw a warning if I am using const?
Javascript
node.js
Constants
Jslint
Jshint
Declaring static constants in ES6 classes?
Javascript
Class
Constants
Ecmascript 6
Swift: Global constant naming convention?
Naming Conventions
Constants
Swift
Global
What kind of optimization does const offer in C/C++?
C++
C
Constants
Compiler Optimization
constexpr vs. static const: Which one to prefer?
C++
C++11
Constants
Constexpr
Why must const members be initialized in the constructor initializer rather than in its body?
C++
Constructor
Initialization
Constants
int vs const int&
C++
Coding Style
Reference
Constants
casting non const to const in c++
C++
Types
Casting
Constants
What is the best way to implement constants in Java?
Java
Constants
What is the difference between const and readonly in C#?
C#
.Net
Constants
Readonly
'Static readonly' vs. 'const'
C#
Constants
How to declare a constant Guid in C#?
C#
Constants
Guid
Compile Time-Constant
Are private constants possible in PHP?
Php
Constants
Private
Returning temporary object and binding to const reference
C++
Reference
Constants
"sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers" warning
Objective C
Nsstring
Warnings
Constants
What's the reasoning behind putting constants in 'if' statements first?
C++
Coding Style
Constants
If Statement
How do I specify an integer literal of type unsigned char in C++?
C++
Integer
Constants
Language Lawyer
PHP - use array as class constant
Php
Arrays
Constants
How to declare a static const char* in your header file?
C++
Constants
What is the type of string literals in C and C++?
C++
C
String
Constants
Namespace constant in C#
C#
Namespaces
Constants
Const correctness in C vs C++
C++
C
Constants
non-member function cannot have cv-qualifier
C++
Templates
Constants
Check if a class constant exists
Php
Constants
Use if else to declare a `let` or `const` to use after the if/else?
Javascript
If Statement
Reactjs
Constants
Let
How do I declare an array as a constant in Objective-c?
Objective C
Arrays
Constants
Scope of Constants in Ruby Modules
Ruby on-Rails
Ruby
Module
Constants
How to redefine a Ruby constant without warning?
Ruby
Constants
Redefine
Redefinition
What's the point of const void?
C++
C
Function
Constants
Void
Morbid use of constants
Java
Constants
Whyever **not** declare a function to be `constexpr`?
C++
C++11
Constants
Constexpr
Function Declaration
constexpr const vs constexpr variables?
C++
C++11
Constants
Constexpr
How to get name of the constant?
Php
Class
Constants
How do I define constant values of UIColor?
Objective C
Cocoa Touch
Constants
Uicolor
Java multiple arguments dot notation - Varargs
Java
Constants
What is the difference between char * const and const char *?
C
Pointers
Constants
Pointer declared as constant as well as volatile
C
Constants
Volatile
Conditionally initializing a constant in Javascript
Javascript
Ecmascript 6
Constants
Double pointer const-correctness warnings in C
C
Constants
Implicit Conversion
Qualifiers
Multiple Indirection
When to use static constant and variable in Swift?
Ios
Swift
Variables
Static
Constants
What's the difference between const array and static const array in C/C++
C++
C
Arrays
Static
Constants
How can I use enum in C# for storing string constants?
.Net
String
Constants
Enums
Can I use const in vectors to allow adding elements, but not modifications to the already added?
C++
Stl
Constants
Can you use static constants inside classes in PHP?
Php
Class
Variables
Syntax
Constants
Infinite loop in constructor without for or while
C++
Recursion
Constructor
Constants
Disable check of camel case rule in eslint
Constants
Eslint
Camelcasing
Disable
Why can't I convert 'char**' to a 'const char* const*' in C?
C
Pointers
Constants
Const Correctness
Is the sizeof(enum) == sizeof(int), always?
C
Enums
Constants
C Preprocessor
How to avoid code duplication implementing const and non-const iterators?
C++
Iterator
Constants
Dry
What are top-level const qualifiers?
C++
Constants
Are variables declared with let or const hoisted?
Javascript
Ecmascript 6
Constants
Let
Hoisting
Why is `const T&` not sure to be const?
C++
Templates
Constants
Function Templates
Const Reference
Where are constant variables stored in C?
C
Variables
Memory Management
Constants
Global
Constant DateTime in C#
C#
Datetime
Attributes
Constants
why does accessing an element in an array take constant time?
C
Arrays
Time
Constants
Complexity Theory
Abstract constants in PHP - Force a child class to define a constant
Php
Constants
Abstract
Can a const variable be used to declare the size of an array in C?
C
Arrays
Constants
Why would someone use #define to define constants?
C++
Constants
C Preprocessor
static const vs. const static
C++
Class
Constants