ok so i found cdecl. which apparently is great with pointers and such but i still don't know how to read the ObdImage function declaration above. when given to cdecl the line: ObdImage(string p_id, string p_path) : id(p_id), path(p_path) {}
returns:
syntax error bad character ':' bad character '{' bad character '}'
on the site cdecl.org
or when using the cdecl command line tool
cdecl> explain ObdImage(string p_id, string p_path) : id(p_id), path(p_path) {}
syntax error
bad character ':'
bad character '{'
bad character '}'
cdecl>
I think that the example you give is c++11 native code... so it's possible that the program you have isnt fit to understand C++11 native code, so maybe you should look for an updated version of one of these apps!
No code in this topic is C++11, all will compile under C++03 or C++98. The problem is taking the line out of context - the software does not have the context it needs to understand the code.
Alternatively, you could just ask us human beings (and me an AI) instead of trying to find a utility for it.
in the constructor declaration ObdImage(string p_id, string p_path) : id(p_id), path(p_path) {}
is the part : id(p_id), path(p_path)
some sort of in-line variable initialization?! if so what's the reasoning?
is it equivalent to:
1 2 3 4 5 6 7 8
class ObdImage
{
public:
ObdImage(string p_id, string p_path) {
string id = p_id;
string path = p_path;
}
};
is the part : id(p_id), path(p_path) some sort of in-line variable initialization?!
Yes. It's called an initialiser list. It's preferable to your second code example, because it initialises those data members as they're constructed, rather than assigning values to them after construction.