Re: Non-declared Variables

Gene Wirchenko <genew@ocis.net>
28 Jan 2007 01:40:15 -0500

          From comp.compilers

Related articles
Non-declared Variables acampbellb@hotmail.com (Avatar) (2006-10-16)
Re: Non-declared Variables int2k@gmx.net (Wolfram Fenske) (2006-10-17)
Re: Non-declared Variables gnorik@gmail.com (2006-10-24)
Re: Non-declared Variables Peter_Flass@Yahoo.com (Peter Flass) (2006-10-26)
Re: Non-declared Variables pjb@informatimago.com (Pascal Bourguignon) (2006-10-28)
Re: Non-declared Variables ArarghMail610@Arargh.com (2006-10-28)
Re: Non-declared Variables genew@ocis.net (Gene Wirchenko) (2007-01-28)
| List of all articles for this month |

From: Gene Wirchenko <genew@ocis.net>
Newsgroups: comp.compilers
Date: 28 Jan 2007 01:40:15 -0500
Organization: Posted via Supernews, http://www.supernews.com
References: 06-10-064 06-10-098 06-10-109 06-10-120
Keywords: design, comment
Posted-Date: 28 Jan 2007 01:40:15 EST

ArarghMail610@Arargh.com wrote:


>On 26 Oct 2006 00:28:58 -0400, Peter Flass <Peter_Flass@Yahoo.com>
>wrote:
>
>>gnorik@gmail.com wrote:
>>> I don't think that it is a good idea when language definition allows
>>> you to use variables without declaration.
>>> First of all, it leads to bugs which is rather hard to find.
>>
>>I would expect the compiler to issue a message for this, unless
>>undeclared variables are the norm for this language, as in Rexx. PL/I,
>>for example, has language-specified defaults and default rules, but all
>>compilers I know of also warn.
>
>MS Basic 16-bit compilers for the most part, didn't.
>
>Come to think of it, I don't think that the 32-bit ones do either.
>
>The exception to that is that some support an "OPTION EXPLICIT" which
>causes an error for undeclared variables, when used.


        In VB6, you can set this to be included in any new program file. I
always used it.


>[BASIC never required declarations, even for arrays. -John]


          It sure did. If you did not declare, then you got a default size
of 10 in each dimension of the first use.


Sincerely,


Gene Wirchenko
[Hey, people wrote lotsa student Basic programs with 10x10 arrays. If you
needed something bigger, which happened less than you might expect, then
you had to DIM them. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.