Description:
GNU C++ compiler (G++) user queries and answers.
|
|
|
Converting char * into the string?
|
| |
Hi, I have a function which takes string as an argument, but while calling this function I am actually passing char * (not const char *). This function uses the argument and populate the private variable which is of string type. In the product its showing some strange behaviour i.e. crashing once in a while (not always) in other function while accessing the string variable which is class variable. Just want to check if the issue is with the passing of the variable which is of char * type.... more »
|
|
my overrides cannot be found by compiler
|
| |
consider this header file (validate_floats) at
[link]
basically it declares several overrides for function bool
validateFloats(some type), and a templated version for the case where the
type is a std::vector<T>, which calls validateFloats(T) for all the elements... more »
|
|
Unexplained compilation error.
|
| |
I have stared at this code fragment and I am not seeing the error. This
is from a piece of code that used to compile, but I am migragrating the
code from the depreciated hash_map to an unordered_map. There is
*obviously* something wrong here, but I am just not seeing it.
================Begin test.cc======================= ====... more »
|
|
pointer reference counting in C++
|
| |
Got the following code for the pointer reference counting in C++, but the answer is not as expected. Looks I am doing something wrong. Please help.
#include using namespace std;
template class RefCountPtr {
public: explicit RefCountPtr(T* p = NULL) {
Create(p);... more »
|
|
Types table size and format in the .gcc_exception_table
|
| |
As part of my research I am updating the .gcc_exception_table of a binary 64 bit elf file. For small C++ programs that throw exceptions it works OK, but for large benchmark programs it's not working. My question is does GCC stores more than one table inside the .gcc_exception_table section of the elf file. If it does what's the exact format of these tables. I have some knowledge of the action table, action records and types table. I am not clear about the size of the types table.... more »
|
|
fpermissive
|
| |
I found this error many times during program, but didnot know what is
this fpermissive and how to use it
error: invalid conversion from ‘int*’ to ‘int’ [-fpermissive]
sometimes I got warnings like: code will accepted with -fpermissive
what is fpermissive?
how to use it?
|
|
Missing iostream
|
| |
The c++ test routine that I am prototyping under qt creator includes the following:
...
The build returns this error line:
iostream: No such file or directory. I cannot seem to find the relevant library.
-- ______________________________ ____
Mageia 2 for x86_64
Kernel: 3.4.13-desktop-1.mga2... more »
|
|
Bug?
|
| |
Is the following a known bug or possibly not a bug in some weird way?
struct outer {
template<class T> struct inner { };
...
template<class T, class... U>
void f(typename T::template inner<U...>*) { }
int main() {
f<outer, int>(nullptr);
return 0;
...
The compiler yields:... more »
|
|
|