Jump to content

Recommended Posts

Posted

Bug in 3.3.9.21 with Static

Func _Test()
    Return 7
EndFunc

Func _MyFirstFunc()
    Local Static $Test = _Test(), $FuncName = 'Dummy One'

    ConsoleWrite('FuncName is: ' & $FuncName & @CRLF)
EndFunc

Func _MySecendFunc()
    Local Static $Test = _Test(), $FuncName = 'Dummy Two'

    ConsoleWrite('FuncName is: ' & $FuncName & @CRLF)
EndFunc

_MyFirstFunc()
_MySecendFunc()

outputs: :ranting:

FuncName is: Dummy One
FuncName is: Dummy One

properly it would be:

FuncName is: Dummy One
FuncName is: Dummy Two
Posted

I tested this, and if you remove the call to the _test function in your _MySecendFunc() it evaluates correctly (just a point of clarification, not saying it's not a bug). You should definitely post this in the bug trak because it's not working the way it should be.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

The issue isn't present in v3.3.8.1.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • Moderators
Posted (edited)

Hi,

Although it makes no difference in this case I would point out that using "Local Static" is incorrect syntax, as would be "Local Global". Only one of the "Local/Global/Static" triad should be used when declaring variables. ;)

M23

Edit: It appears I am wrong (see below). :(

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

Local Static is correct syntax. It's also more correct syntax.

Local means it's accessible only inside that function. If only Static is used then Local is implicit.

♡♡♡

.

eMyvnE

  • Moderators
Posted

trancexx,

Thanks for the correction. :)

Although I can see little point in further scoping a Static variable. Global Static is tautological and serves no useful purpose at all that I can see - and if Local Static is implicit, why bother? :wacko:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted (edited)

It's probably still in development, jpm posted that so you know it's been fixed.

I say that you should not use beta for developing release applications, for obvious reasons. ;)

Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Posted
  On 11/4/2013 at 4:38 PM, Taz77 said:

Is there a way to download v3.3.9.22? I can't find the download.

 

at the right time, the right file will be here:

http://www.autoitscript.com/forum/files/

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Moderators
Posted

Taz77,

You will have to wait until the next Beta release - jpm means that the code within the repository has been amended, not that it is released. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

  • Moderators
Posted

Taz77,

  Quote

Sorry for my bad English

No need to apologize - ich habe nur ein bisschen Deutch mich. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

  • Moderators
Posted

DatMCEyeBall,

I did say I did not speak it well! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

  On 11/4/2013 at 12:12 PM, Melba23 said:

trancexx,

Thanks for the correction. :)

Although I can see little point in further scoping a Static variable. Global Static is tautological and serves no useful purpose at all that I can see - and if Local Static is implicit, why bother? :wacko:

M23

Sure, no problem.

It's very simple to answer your question, what's implied today doesn't have to be the same thing that would be implied tomorrow. Explicit declaration means writing both forward and backward compatible code and gives programmer full control. Good programmer wants full control because possibility of code having bugs (subtle or not) is then at minimum.

♡♡♡

.

eMyvnE

  • Moderators
Posted

trancexx,

Thanks for that. In light of your comments I have rejigged the Variables - using Global, Local, Static and ByRef tutorial in the Wiki - if you have a moment could you take a look and make sure I have correctly reflected them. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted (edited)

I have no doubt you did it good. Maybe just to mention Const Byref as it's valid option for user functions parameters.

...And anally to change the example of "good use" for Static to use bool which is initially set to False and changed to True in Else to follow example's description fully.

Edited by trancexx

♡♡♡

.

eMyvnE

Posted

On the subject of being strict (or that a word!) I will look at removing the values in MsgBox() and using the constant variables. Most likely I will do it in the evening.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • Moderators
Posted (edited)

trancexx and guinness,

Thanks - I will deal with the points from both of you today. :)

M23

Edit: All done if you wish to check. :)

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...