Why Bother With Line Numbers?
Read an Expert's opinion:
|Peter Morris, in Advanced Microsoft Visual Basic 6,
Chapter 1: "On Error Goto Hell".|
- "... In Visual Basic, Erl, a Visual Basic (undocumented in
Visual Basic 4 and 5 but present in all versions of Visual Basic thus far) "global
variable," gives you access to the line number of any erroring line of code. So by
using line numbers and by using Erl in your error handlers, you can determine
which line of code erred--wow! What happens to Erl if you don't use line numbers?
Easy--it will always be 0."
- "At TMS, we don't work with line numbers in our source code, however. We add them
only when we're doing a ship build--that is when we want to ship a binary to, say, beta
testers or to manufacturing for an impending release. We use our internal tool to build a
new version of the code, complete with line numbers, and then we make an executable from
that. We store the line numbered source code in our source control system and ship the
executable. We cross-reference the EXE version number (the Auto Increment option is just
great here) to the source code stored in the source control system. Every time we do a new
build for shipping, we create a new subproject whose name is the version number of the
build and store the line numbered source code in it along with a copy of the binary image.
If an error report comes in, we can easily refer back to the source code to find the
erroring line (very, very easy if you're using Microsoft Visual Source Safe). Typically,
the error report will contain details of the module, routine, and line number of the