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.

AppGameKit Classic Chat / option explicit

Author
Message
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 31st Dec 2014 22:28
HI Guys:

couldn\\\\\\\'t get any better restarting with AppGameKit V2 after more than a year of interruption.

\\\"#option_explicit very clear for me but couldn\\\'t find its value within tier1 as if you declare any variable within #include, it will be noticed by the compiler.

any example to show a good use for it.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 1st Jan 2015 00:48
the problem was misspelling, this auto declaration create invisible code,
thats why option explicit is much better.
also much people using global vars, u did not see if a var was declared
in a function or outside.

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 2nd Jan 2015 05:05
Thanks Markus

but still not making its value. the Idea behind option explicit in c++ is to declare a value that you can initiate else were. which is very useful in functions such as AGK::begin(). were in large programs, you can delare values in another .h file to reduce the use within the begin() function.

however, I don't want this thread to last long but still would like to see example to know the real benefit.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Jan 2015 11:17
Quote: "the Idea behind option explicit in c++ is to declare a value that you can initiate else were"


This is not what Option Explicit is for. There is no Option Explicit in C++, it is always on. Declaring a variable as explicit (not Option Explicit) is another thing altogether.

Option Explicit simply states that all variables must be declared before they can be used.

Quidquid latine dictum sit, altum sonatur
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 2nd Jan 2015 12:25 Edited at: 2nd Jan 2015 12:27
i believe we gave it the name Option Explicit from visual basic 6 and
not thought that in c++ it have other sense.

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 2nd Jan 2015 12:45
thanks guys, I got it. I was thinking that it would match declaring variables as explicit in C++.

Yet am I will see any cool use for it as programs get bigger.

Login to post a reply

Server time is: 2024-11-25 14:59:30
Your offset time is: 2024-11-25 14:59:30