Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
minus_273c
15
Years of Service
User Offline
Joined: 16th Aug 2010
Location:
Posted: 23rd May 2012 12:43
Does DB Pro have the equivalent of the VB compiler command 'Option Explicit', which prevents you from using variables without declaring them first?

I have a, probably not unique, skill when it come to subtley mis-spelling variable references in a way that's hard to notice. This obviously causes all sorts of debugging 'fun' that can be easilly avoided if the compiler reports an attempt to use an undeclared variable.


Life is not a zero-sum game.
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 23rd May 2012 15:48 Edited at: 23rd May 2012 15:48
No there is no Option Explicit equivalent

However, the project will not compile if you use an undeclared type field (or property)



Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 23rd May 2012 23:25
Quote: "Does DB Pro have the equivalent of the VB compiler command 'Option Explicit', which prevents you from using variables without declaring them first?"

no, but you can declare a type and put all your variables inside it. When you try to use a variable from a type that doesn't exist you'll get a compiler error

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd May 2012 23:37
you probably could even use a single dimensioned array. DB should complain if it does exist.



Enjoy your day.
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 24th May 2012 00:31
The overhead of arrays is a lot more than for UDTs though.

[b]

Login to post a reply

Server time is: 2026-07-22 00:35:40
Your offset time is: 2026-07-22 00:35:40