M
mast2as
I have posted a few messages in the last few days about a project I am
working on which is a quite simple parser. I ended up using the try/
catch structure as a general mechanism to control what's happening in
the program when it finds a syntax error in the file it parses. I
would like to know if this is 'an acceptable thing to do' from a
programmation point of view, or if I should keep using it only for
catch exception created withing the program.
For example i do things like that for now
// if syntax error in the parsed file
void ParseFile()
{
...
throw( "syntax error in the file at line 23, in test.dat" )
...
}
try
{
ParseFile()
}
catch( const char *msg )
{
std::cerr << msg << std::endl;
}
Thank you -mark
working on which is a quite simple parser. I ended up using the try/
catch structure as a general mechanism to control what's happening in
the program when it finds a syntax error in the file it parses. I
would like to know if this is 'an acceptable thing to do' from a
programmation point of view, or if I should keep using it only for
catch exception created withing the program.
For example i do things like that for now
// if syntax error in the parsed file
void ParseFile()
{
...
throw( "syntax error in the file at line 23, in test.dat" )
...
}
try
{
ParseFile()
}
catch( const char *msg )
{
std::cerr << msg << std::endl;
}
Thank you -mark