Questions tagged as 'constantes'

3
answers

Constant containing Array (array)

When I try to define a constant as an Array it gives error. define('COLORS', ['red', 'blue', 'green']); Is there any way to define an Array in the value of a constant?     
asked by 20.06.2015 / 03:50
4
answers

Create const string array in C #

Is there a way to create a constant array of string ? Something like: class Teste { public const string[] Array = new string[] {"a","b"}; } But it does not compile. In this case no would replace const with static read...
asked by 10.09.2015 / 19:01
1
answer

const declaration at the end of function in C ++ and const before the argument in method

I came across this snippet of code in a material: class Foo { public: int Bar(int arg1) const //<-- qual função do const aqui? { // código a ser implementado aqui } }; [1] How does const affect this statement of method B...
asked by 09.08.2015 / 14:15
1
answer

Why define a constant for the same document and check if it exists in the document itself?

I see in many codes that programmers are a constant and in the document itself check if this constant exists (has been defined) in itself. I would like to know why this happens. When we download the open platform from the phpBB3 platform, o...
asked by 20.12.2014 / 10:38
1
answer

Can excessive use of constants affect system performance?

I use a lot of constantes in php to save information to configure the system    Example: define('_CONFIG_SERVER','PC\SQLEXPRESS'); define('_CONFIG_DATA','Database'); define('_CONFIG_NAME','localhost'); define('_CONFIG_LANGUAGE_DEFAU...
asked by 09.02.2016 / 18:33
1
answer

What's the difference between declaring a variable like constexpr const and constexpr?

What's the difference between declaring a constant as constexpr const to only a constexpr ? constexpr const float max_height = 3.0f; constexpr float max_height = 3.0f;     
asked by 29.09.2018 / 20:39
0
answers

Methods that return constant values in C and C ++ even if they come from variables, is it possible?

In a series of optimizations in a code written in C ++ I adopted a class to store data of parameterization of the application and some pseuconstantes let's say so. What actually happens is that when the application initializes it gets all par...
asked by 15.10.2016 / 11:29
1
answer

Define the value of the variable as an equation

I wanted an equation to appear as a function of x and not the value of the equation, is it possible? I did not find anything, and I'm now starting to program in javascript and I do not know much     
asked by 27.06.2015 / 18:55
3
answers

How to print a constant in the middle of a string, without concatenating?

Is there any way to print a constant in the middle of a string , without using concatenation, how do you do with variables in PHP? Example: $nome = 'wallace'; echo "Meu nome é {$nome}"; For constants, I know I could print concatenatin...
asked by 15.09.2015 / 22:53
3
answers

How to declare a constant in Ruby?

How to declare a constant in Ruby? In other languages I do something like: const CONSTANTE = 1024 And CONSTANTE can not be changed at run time. But I do not think anything like it in Ruby.     
asked by 13.11.2017 / 15:21