Posts by André Agenor • 93 points
12 posts
-
0
votes3
answers144
viewsA: Type declaration in parentheses
Your question has already been answered, but just to complement, in modern C++ you should avoid C-Style Cast. // Bad int v = (int)std::pow(3, 2); // Good int v = static_cast<int>(std::pow(3,…
-
0
votes1
answer38
viewsA: Visual Studio C++ Strings in Hexa
You can use the comma std::string a1 = "\x0A"; int x; std::stringstream ss; ss << std::hex << a1; ss >> x; std::string final{std::to_string(x)}; std::cout << final <<…
-
0
votes2
answers104
viewsA: How to correctly choose a data type
Currently with C++ Modern you can opt for "auto" in most cases. In the case of float and double, double really performs the best operations on 64bit equipment, because the alignment of memory…
-
0
votes3
answers99
viewsA: If I declare a variable and do not use it in the body of the program, will it compile?
In case you want to keep only to remember you can mark as momentary, so there is no risk to be occupying unnecessary memory, although as already mentioned by colleagues above, depending on the…
-
-2
votes2
answers112
viewsA: Abstract methods do not require implementation
Check the function that will override, this will make the compiler error when trying to instantiate the abstract class. You must use a virtual destructor as well. Try enabling the compiler warnings…
-
3
votes3
answers586
viewsA: What does the 3-bar C++ comment mean?
Normally three bars are used when creating documentation for your code. You can use Doxygen for this. Doxygen There are some specific tags that are used to define how the document will be generated.…
c++answered André Agenor 93 -
1
votes3
answers6815
viewsQ: Eslint captured an error, Parsing error: Unexpected token =
Hello, I installed Eslint to capture the errors and check the code, but the same is picking up this error on line 28 "updateDay = () => {" where the problem is in this syntax with = before (),…
-
2
votes1
answer788
viewsQ: Enter link in URL does not load page
I have a strange problem. I’m browsing a SPA using React router v4, it’s working if vc starts the root navigation, but if vc type the address directly in the URL it gives an error. Below is the code…
reactasked André Agenor 93 -
1
votes1
answer305
viewsQ: Pass component to the child
There is a way for me to pass a specialized component to a child by props? I have a situation where I want to reuse as much as possible, without having to duplicate it, and I don’t really understand…
reactasked André Agenor 93 -
1
votes1
answer542
viewsQ: Update status by observing the date change
Hello, I’m making a component that shows the current date, but I would like to update it as soon as there is the change, but I was only able to leave it active for change with a timeout, which I…
reactasked André Agenor 93 -
0
votes2
answers147
viewsQ: Organization of projects with qMake
I’m developing a project and would like to start separating things into smaller parts and also to be able to test those parts, so researching found something about using the *.pri files to be able…
-
1
votes1
answer72
viewsQ: Help with regular expression
Hi, I need a hand with Regex. I need to split a string to store in a list, so I’m doing like this. QString a = "strength 0.5"; QString b = "'kernels[1].params.sigma_albedo' 0.02"; QString c =…