VFP 9 SP 1 I ran across this oddment today:
Consider an SCX form containing a textbox, a command button, and a method called ProcessIt(). If you press the command button, THISFORM.ProcessIt() is called. ProcessIt() LOCAL thelastname thelastname = "" IF NOT EMPTY(THISFORM.Text1.Value) thelastname = ALLTRIM(THISFORM.Text1.Value) IF [?] $ thelastname OR [/] $ thelastname ; OR [\] $ thelastname OR [(] $ thelastname ; OR [)] && Obvious error here (unless you're tired and didn't catch it...) MESSAGEBOX("Invalid input.") ENDIF ENDIF * Just for grins... IF ")" MESSAGEBOX("Invalid input.") ENDIF If you type this code into the method and save the form, the auto-compile feature won't complain. But this is obviously bad syntax, as you can find out if you try to run the code in the command window. You'll get a data type mismatch error. I'm used to auto-compile not detecting errors in .prg-based code unless I go through the contortions necessary to invoke Intellisense. I've come to expect better behavior in SCX and VCX methods though. Still, I was aware that even in an SCX form the auto-compile can't detect data-type mismatches involving the unambiguously-defined contents of variables--though that surprises me since the command window will do so. But I didn't realize the auto-compile can't detect a data-type mismatch on a comparison expression involving a string literal. Nor will the full compile of an executable containing this error. This little oddment cost me three hours of debugging. It's weird enough that it caused the obliteration of several levels of stack trace in my executable at run time. The stack trace data from ASTACKINFO() didn't show up in my error handler's log output until it was well past the point of the error and into my shutdown routine. Took me forever to find the source of the error. Any comments? Thanks. Ken Dibble www.stic-cil.org _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/5.2.1.1.1.20120913210706.01f69...@pop-server.stny.rr.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.