Jump to content

Recommended Posts

Posted (edited)

Okay, I'm totally confused about the 'align' directive now (testing now on 3.3.7.4). Once a 2nd align is encountered, whether inside a nested Struct/EndStruct, the rest of the inner and outer structs follow the alignment.

Examples - 1st results in 11 bytes, 2nd result (without the 2nd align) is 16 bytes:

$sStruct="double outer1; STRUCT; byte inner1; align 1;char inner2; ENDSTRUCT; char outer2"
$stStr = DllStructCreate($sStruct)
ConsoleWrite("Structure size:"&DllStructGetSize($stStr)&@CRLF)

$sStruct="double outer1; STRUCT; byte inner1; char inner2; ENDSTRUCT; char outer2"
$stStr = DllStructCreate($sStruct)
ConsoleWrite("Structure size:"&DllStructGetSize($stStr)&@CRLF)

*edit: Note - Remove the Struct/EndStruct directives and the same size is returned

Edited by Ascend4nt
  • Administrators
Posted

Oh, so it's a bug in AutoIt itself in one of the betas that only happens with x64? In other words, AutoIt is broke, not the script.

Yeah, totally. The only things that should ever break x64 scripts are bad structs and dllcalls really. </in theory>

Urgh. Found the 6 lines that cause the problem - except they are correct so it makes no sense >.<

Posted

According to Jon's it was introduced with 3.3.7.3.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)

What is wrong with Label? If you pass an empty string and does not specify the height (fifth parameter), the size will be wrong.

GUICreate('MyGUI', 200, 100)
GUICtrlCreateLabel('', 10, 10, 180)
GUICtrlSetBkColor(-1, 0xFF0000)
GUISetState()

Do
Until GUIGetMsg() = -3
Edited by Yashied
  • Administrators
Posted

What is wrong with Label? If you pass an empty string and does not specify the height (fifth parameter), the size will be wrong.

GUICreate('MyGUI', 200, 100)
GUICtrlCreateLabel('', 10, 10, 180)
GUICtrlSetBkColor(-1, 0xFF0000)
GUISetState()

Do
Until GUIGetMsg() = -3

Hmm, at a loss on this one. I just reverted my source tree back to the production version and recompiled and it doesn't work there either. Maybe it's an old hidden bug that's now being shown up in the new compiler...
  • Administrators
Posted

Hmm, at a loss on this one. I just reverted my source tree back to the production version and recompiled and it doesn't work there either. Maybe it's an old hidden bug that's now being shown up in the new compiler...

Yes, this was the case. An uninitialised variable was usually 0 on the old compiler, it wasn't on the new one and so bad things happened.
Posted

Yes, this was the case. An uninitialised variable was usually 0 on the old compiler, it wasn't on the new one and so bad things happened.

Out of curiosity, what value (if any :huh2: ) does an uninitialised variable have on the new compiler?
Posted

Out of curiosity, what value (if any :huh2: ) does an uninitialised variable have on the new compiler?

An uninitialised variable just reserves some memory. Since the part of the memory can contain remains of old data, this will be the "value". Maybe an implicit "initialise to zero" was dropped in favor of speed in the new compiler.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Posted

An uninitialised variable just reserves some memory. Since the part of the memory can contain remains of old data, this will be the "value". Maybe an implicit "initialise to zero" was dropped in favor of speed in the new compiler.

Thanks, that's a very clear answer. :huh2:
  • Administrators
Posted (edited)

No, I'm saying that AutoIt (as all C programs) may have subtle bugs because some variables were left uninitialised and have yet to be discovered due to pure chance of the combination of OS/Compiler/Memory/Previous exes ran. In this case it looks like the author thought that this variable didn't need initialising because the logic of the following code would always assign it a value. That assumption was incorrect if it was passed a blank string.

VC9 didn't initialise variables to 0 either, it's just luck that in this case, for whatever reason, it consistently picked an area of memory that just happened to be 0 to store the variable. We had similar bugs whenever we moved from compiler to compiler before.

But as least we don't have to worry about running another program on our code to check for these sorts of errors, eh, James? :huh2: (Edit: Or was it Richard who made that comment? I forget)

Edited by Jon
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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