Re: How to improve this
On Dec 11, 5:00 pm, "Asger Joergensen" <J...@Asger-P.dk> wrote:
Hi Ebenezer
Ebenezer wrote:
In the past I've asked for code review comments on the
code in the archive here --
http://webEbenezer.net/build_integration.html.
I didn't get a lot of response to that.
Do You really find that strange ???
Ask Your self if You, without any knowledge of the project, would start
investigating in response to a post like Yours.
If You want help / suggestions, You must post some specific code and then
ask if that can be improved.
Fortunately I have a specific question also that I posted
on another forum yesterday and haven't gotten a reply there.
class failure : public ::std::exception {
flex_string<char> whatStr;
public:
explicit failure (flex_string<char> const what_) : whatStr(what_)
{}
~failure () throw()
{}
char const* what () const throw()
{ return whatStr.c_str(); }
template <typename T>
failure& operator<< (T val)
{
::std::stringstream ss;
ss << val;
whatStr.append(ss.str().c_str());
return *this;
}
};
class eof : public ::std::exception {
flex_string<char> whatStr;
public:
explicit eof (flex_string<char> const what_) : whatStr(what_)
{}
~eof () throw()
{}
char const* what () const throw()
{ return whatStr.c_str(); }
};
I thought of changing the second class, eof, like this:
class eof : public failure {
public:
explicit eof (flex_string<char> const what_) : failure(what_)
{}
~eof () throw()
{}
};
That seems better, but two executables each become a couple
hundred bytes larger with that latter approach. The increase
in the size of the executables happens with g++ 4.5.1 and 4.6.2.
One question would be which version of eof would you use?
I'm inclined to stick with the original/longer version, because
the compilers I've checked handle it better.