Most voted "const" questions
9 questions
Sort by count of
-
9
votes1
answer90
viewsWhy are there two const in the variable statement?
I can do it: const int* const objeto = &x; Why are there two const? What is the function of each?
-
6
votes2
answers929
viewsWhat is the difference between expressions : "int a" and "const int& a" as C++ function arguments?
Let’s assume 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…
-
4
votes1
answer135
viewsWhy does a parameter have two "const" in its statement?
I’m reading the tutorials on the website of lib Opencv 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…
-
4
votes1
answer142
viewsWhat are the differences between macros and constexpr? When is it preferable to use one instead of the other?
I haven’t been in touch with C++, 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, example: #define MAX_ENTRIES = 10…
-
1
votes1
answer133
viewsWhat is the difference of declaring a variable as constexpr const and constexpr?
What is the difference of declaring a constant as constexpr const for only one constexpr? constexpr const float max_height = 3.0f; constexpr float max_height = 3.0f;…
-
0
votes1
answer75
viewsMultiples Inserts with JS (works in the browser but in the app generated by phonegap build not)
Updating by the @Sveen indication solution, in exchange var for const, but it only worked in the browser, in the app it continues replicating only one value: for (var i in dados.valor) { const query…
-
0
votes1
answer41
viewsWhere to place a Modal "const" of the Material UI inside a Class in Reactjs?
I have a problem of not knowing where to put the const "const [open, setOpen] = React.useState(false);" of a Modal from the Material UI, within my Generatereport class. When I put " const [open,…
-
-1
votes2
answers38
viewsHow to make constant member functions in Php?
I was studying what my book called "constant member functions" in C++. i.e., functions that cannot change any class attribute or call other methods that are not constant. So, I made this code in…
-
-1
votes3
answers57
viewsConvert stopwatch to hh mm ss format
My stopwatch is running without format 00:00:00 I created a div in index.html <!-- TIMER --> <div class="container"> <span id="display">00:00:00</span> </div> No js…