Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
Compiler
Delphi
Anonymous Methods
BASM
Code Generation/Optimization
Error Recovery
Errors - Warnings
Exceptions
Execution
Finalization
Generics
Header Generation
Interaction with UI
Interfaces
Language
Linker
Make Logic
Memory Manager
OBJ Generation
OBJ Support
Other Compiler
Packages
RTTI
String Resources
TD Debug Info
Thread Local Storage
Version resilience
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/Compiler/Delphi/Packages
[ Add a report in this area ]
Report #:
71588
Status:
Open
Global Variable is not initialized to 0
Project:
Delphi
Build #:
12.0.3210.17555
Version:
12.1
Submitted By:
Serge (Developer Express Support)
Report Type:
Basic functionality failure
Date Reported:
2/18/2009 3:41:24 PM
Severity:
Infrequently encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All versions
Internal Tracking #:
268360
Resolution:
None
(Resolution Comments)
Resolved in Build:
:
None
Duplicate of:
None
Voting and Rating
Overall Rating:
No Ratings Yet
0.00 out of 5
Total Votes:
None
Description
None
Steps to Reproduce:
Run the attached sample and click the button twice.
You'll get an assertion exception, because there is a global variable in Package3 whose value is verified for being zero or not.
Workarounds
None
Attachment
dxSample_B35208.zip
Comments
Serge (Developer Express Support) at 3/4/2009 4:12:25 PM
-
Here is the snippet from the "Variables" help topic (ms-help://embarcadero.rs2009/devcommon/variables_xml.html):
If you don't explicitly initialize a global variable, the compiler initializes it to 0. Object instance data (fields) are also initialized to 0. On the Wiin32 platform, the contents of a local variable are undefined until a value is assigned to them.
It seems to contradict your resolution. Could you please comment on this?
Norbert Eggert at 3/21/2009 8:30:35 AM
-
That´s wrong! In Delphi2006 the varialbe is 0. In Delphi2009 make the compiler by extended-variables after initialize not zero!. Older programms(2006) compiled with Delphi2009 have now Eoverflow-execpetions. Simple example : var ex : extended begin if ex < 0 then ...
Lutz Ristau at 3/5/2009 8:34:04 AM
-
I dont use packages and I dont know the reported problem, but the resolution comment 'by design' is wrong.
The Delphi 6 Help states:
"If you donÂ’t explicitly initialize a global variable, the compiler initializes it to 0. Local variables, in contrast, cannot be initialized in their declarations and contain random data until a value is assigned to them."
From all my experience, this statement is true. This the same as all C/C++ compilers do.
Tomohiro Takahashi at 3/5/2009 9:21:19 PM
-
I'm looking into the attached projects...
But, I can not build your prjects with compiler error...
Lutz Ristau at 3/6/2009 12:29:20 AM
-
Just for information (for the guy who made the "by design" comment): This initialization of global variables is not done by code. Its done by the OS loader, when the data segment for the global variables is created in the process address space. Maybe this is different for packages.
Serge (Developer Express Support) at 4/29/2009 10:05:29 AM
-
Any progress on this issue, guys?
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us