Posts by aviana • 348 points
19 posts
- 
		0 votes1 answer84 viewsA: How to resignify bytes without Undefined behavior?The question you exemplified through the code in: template< typename DstDataType , typename SrcDataType > inline DstDataType* RemeanPtrAs( SrcDataType *srcPtr ){ return (DstDataType*)srcPtr ;… 
- 
		-3 votes1 answer65 viewsA: How to calculate a multiplication of matrices with several processes acting simultaneously?The following code is an example translated from the book "C++ Concurrency in Action - Second Edition" by author Anthony Williams. Chapter 8 is almost entirely devoted to this problem you described… 
- 
		1 votes1 answer58 viewsA: Switch from string to int c++Since vc has a fixed date format ("DD/MM/YYYY"), I believe this is the simplest solution. #include <string> #include <iostream> int main() { std::string data = "20/09/2020"; std::string… 
- 
		0 votes2 answers40 viewsA: Relate a user input to a class pointerMy suggestion for you is to use a vector as a book container and use the structure indexers as options in a selection menu. #include <vector> #include <iostream> #include "classes.h"… 
- 
		3 votes2 answers259 viewsA: Invoke child class method in C++There is something I can do so that when invoking the "print" method, the method declared in the child class is invoked? Pai obj = Filha{}; Yeah, but it’s complicated. When you create a Son object… 
- 
		0 votes1 answer35 viewsA: How not to transcribe data in the Tudios visual. In CThat one while ( qtd >0 ) within a switch but out of a case It doesn’t exist, it’s very wrong. Another problem is that you’re making it very confusing for what the quantity variable is for, is it… 
- 
		1 votes1 answer196 viewsA: How to remove an object from a list chained by the value of the attribute in C++?It is possible to do this by implementing a Tipo for int, or polymorphism with a proxy type for Ids inherited by Tipo, or a builder to Tipo who receives int and makes the conversion implicit.… 
- 
		0 votes1 answer28 viewsA: could you help me please . How do I order this struct by short Insert method?Defined by the name, Insertion Sort is an algorithm that sorts a container automatically during insertion. It is useful when every new insertion needs the container to be sorted, in situations where… 
- 
		1 votes2 answers62 viewsA: Volatile and optimizationEditing your code a little to make optimization clearer. #include <stdio.h> int main(void) { int valor = 666; return (valor == 666) ? 1 : 0; } Compiling in GCC with the flag -O3. main: mov… 
- 
		0 votes1 answer314 viewsA: Error to compile Opengl codeMissing put Linker options in gcc: g++ main.cpp -o main -lGLEW And also define a function int main() For a complete project you will also need to link at least Opengl with -lGL.… 
- 
		0 votes1 answer39 viewsA: Conflicting results passing an Array as parameterAs far as I know, it is impossible to do what you are trying to do in C without some kind of access to the array data, such as counting up to the first NULL value. The way it is implemented, you… 
- 
		0 votes1 answer37 viewsA: Error with class destructorYour code lacks destructor implementation. Substitute: ~R4DMatrix3n(); For: ~R4DMatrix3n() = default; If you have a more complicated destructor, replace the default with the implementation.… 
- 
		1 votes1 answer64 viewsA: Double chained list in C using remove functionSubstitute: void remover(LISTA * lista, int valor){ if(list->primeiro->valor == valor){ //... For: void remover(LISTA * lista, int valor){ if(lista->primeiro->valor == valor){ //...… 
- 
		1 votes1 answer28 viewsA: Generic mapping multiple numerical rangesAssuming the ranges are semi-open [min, max), you can solve this problem with the following generic algorithm: //pseudo-código intervalo encontra_intervalo(valor) { para cada possível intervalo i {… 
- 
		1 votes1 answer691 viewsA: The program does not return to the menu after the function call in CYour program has many problems and the solution to your question requires a little more than a one-off change. The program does not return to the main menu pq vc is not managing the data structures… 
- 
		0 votes2 answers237 views
- 
		5 votes2 answers179 viewsA: Is there realloc() in C++?Yes, realloc is unique to C. There is no equal function pq the programming style is different in C++. It is possible to use realloc/malloc/free in C++, but it is not recommended at all. For simple… 
- 
		0 votes1 answer362 viewsA: Problems with c++ function template (Reference not defined for class methods)The undefined reference error is a Linker error and means that the compiler knows that the function has been declared but does not know where the implementation is. This happened with your code pq a… 
- 
		0 votes1 answer55 views