Expert C Programming

(Jeff_L) #1

Fortunately, it is possible to get the effect of dynamic arrays (at the expense of doing some pointer
manipulation ourselves).


Handy Heuristic


Learning from a Program's Messages


It can be instructive to use the strings utility to look inside a binary to see the error
messages a program can generate. You don't even have to look in the binary if the software
has been internationalized and keeps its messages in a separate file. If you did this for yacc
you would notice that its error messages changed in a significant way between two recent
releases. Specifically, the error message


% strings yacc


:


too many states


became


% strings yacc


:


cannot expand table of states


The reason is that yacc was upgraded so that its internal tables are now dynamically
allocated, and expanded as needed.


Software Dogma


Meaningful Error Messages


Interesting strings also occur in compilers. The following strings were all allegedly found in
an Apollo C compiler:


00 cpp says it's hopeless but trying anyway


14 parse error: I just don't get it


77 you learned to program in Fortran, didn't you?

Free download pdf