Questions tagged as 'const'

1
answer

Why are there two const variables in the variable declaration?

I can do this: const int* const objeto = &x; Why are there two const ? What is the function of each one?     
asked by 15.03.2017 / 12:25
2
answers

What is the difference between the expressions "int a" and "const int & a" as function arguments in C ++?

Let's say I have two functions: int soma_a(int a, int b){ return a + b; } and int soma_b(const int& a, const int& b){ return a + b; } What would be the difference between soma_a and soma_b     
asked by 07.08.2018 / 21:55
1
answer

What are the differences between macros and constexpr? When is it preferable to use one instead of the other?

I have not had contact with C ++ for some time, until I decided to create a project to test a solution. As I knew before, I created a macro to use a value as "constant" later, eg: #define MAX_ENTRIES = 10 So Visual Studio recommended that y...
asked by 23.09.2018 / 04:26
1
answer

Why does a parameter have two const's in its declaration?

I'm reading the tutorials on the OpenCV lib site and during reading I saw the declaration of a function with a variable in a format I've never seen. I wanted to know what it means, declare the variable this way. I will post only the prototype of...
asked by 19.01.2017 / 01:44
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
1
answer

Multiple inserts with JS (works in browser but in app generated by phonegap build not)

Updating the solution by @Sveen, changing var by const , however it worked only in the browser, in the app it continues to replicate only one value: for (var i in dados.valor) { const query = "INSERT INTO teste ..."; localDB.t...
asked by 28.03.2018 / 19:03
2
answers

How to make member functions constant in PhP? [closed]

I was studying what my book called "constant member functions" in C ++. that is, functions that can not change any attribute of the class or call other methods that are not constants. So I made this code in C ++. #include <iostream> #i...
asked by 27.07.2017 / 02:03