Xref: utzoo alt.religion.computers:2554 comp.windows.ms.programmer:3280 Path: utzoo!utgpu!cs.utexas.edu!uunet!mcsun!ukc!slxsys!ibmpcug!mantis!mathew From: mathew@mantis.co.uk (Giving C News a *HUG*) Newsgroups: alt.religion.computers,comp.windows.ms.programmer Subject: Re: ap, Windows BASIC Message-ID: <1FV2436w164w@mantis.co.uk> Date: 24 Jun 91 14:29:35 GMT References: <1991Jun22.040758.9453@maverick.ksu.ksu.edu> Organization: Mantis Consultants, Cambridge. UK. Lines: 39 rogerhef@matt.ksu.ksu.edu (Roger Heflin) writes: > In <7451@vela.acs.oakland.edu> awesley@vela.acs.oakland.edu (WESLEY ANTHONY > > How do I > >force QBasic to flag an undeclared variable as an error. If I mistype > >a long variable, no error message, just a new variable. Didn't everyone > >figure out this was a Bad Feature (TM) in a programming language way > >back around FORTRAN-66 or so? > > Can you find me a language that will warn you if you mistype a variable? main() { int mistype, i; mistype = 0; for (i=0; i<10; i++) { mitsype = i * i; // Oops, typo. printf("%d", mistype); } } test.c test.c(7) : error C2065: 'mitsype' : undefined Looks like a warning to me. Modula-2, Pascal and C++ will warn you as well. Lisp will detect the error at run time. In fact, the only language I can think of which will blithely carry on and create a new variable called "mitsype" is BASIC. Oh, and FORTRAN, but I try not to think of that. > Is QB wrong for making that assumption, at least QB doesn't let you mix > your strings and numeric variables up. Nor do Modula-2, Pascal, Lisp, C++, LOGO... mathew