Evaluate a string with a switch in C++ [duplicate]

I want to evaluate a string with a switch but when I read the string entered by the user throws me the following error. error: invalid cast from type ‘std::string {aka std::basic_string}’ to type ‘int

Whats the difference between UInt8 and uint8_t

In C99 the available basic integer types (the ones without _t) were deemed insufficient, because their actual sizes may vary across different systems. So, the C99 standard includes definitions of several new integer types to enhance the portability of programs. The new types are especially useful in embedded environments. All of the new types are … Read more

clearing a vector of pointers [duplicate]

Yes, the code has a memory leak unless you delete the pointers. If the foo class owns the pointers, it is its responsibility to delete them. You should do this before clearing the vector, otherwise you lose the handle to the memory you need to de-allocate. You could avoid the memory management issue altogether by … Read more

What does _T stands for in a CString

_T stands for “text”. It will turn your literal into a Unicode wide character literal if and only if you are compiling your sources with Unicode support. See http://msdn.microsoft.com/en-us/library/c426s321.aspx.

C++ Signed/unsigned mismatch

The signed/unsigned nature of the two values you are comparing should be the same, otherwise one gets cast as the other for the comparison, which can lead to unexpected results. It would be best to make sure that what you’re comparing are the same type, but: If you know which value is safe to cast, … Read more

Why are there two different getline() functions (if indeed there are)?

Bear in mind that the Standard library is composed from 3 (main) parts: IOStream, String and STL, plus some tossed in goodies and the C-headers. I don’t see anything weird in having those parts loosely coupled (though I wish it was not the case). Other incongruities include: std::string::length vs std::string::size, the latter having been added for interface compatibility … Read more

compare and swap vs test and set

test-and-set modifies the contents of a memory location and returns its old value as a single atomic operation. compare-and-swap atomically compares the contents of a memory location to a given value and, only if they are the same, modifies the contents of that memory location to a given new value. The difference marked in bold.

Update g++ but still old version

Installing a newer (or older) version of GCC than the Ubuntu default version via the package manager does not delete the default version. You get both. You can install as many versions as you like. gcc/g++ will continue to run the default version. If you have installed GCC 7, then you run the new compilers with gcc-7 or g++-7. For … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)