The classic problem with compilers and programming is in my opinion the fact that compilers sometimes compile code that looks mathematically incorrect or illogical. This can cause the following problems, a) programmers start to believe that their math is incorrect and lose faith in mathematics, b) programs will not port to other systems.
Here is an example (the quick example ... the long example was a so-called generic parser that worked a couple of years ago and should never have compiled since certain variables were uninitialized at startup, the problem was that when the code actually worked I didn't bother to check for bugs).
finding substrings:-
if( text.find(".") > 0)
{
// process text that contains a "." character
}
This works fine in one part of the program, however later I have to use this :-
int full_stop = -1;
full_stop = text2.find(".");
if( full_stop > 0)
{
// process if string called vlocal contains a full stop
}
otherwise the program does not work. So I have to actually create an integer if I call the function within a loop, or is it breaking for some other reason? Only the guru's who write the compilers really know for sure.
No comments:
Post a Comment