Alexander Klenin  wrote / napísal(a):
On Wed, Nov 28, 2012 at 2:29 PM, Jonas Maebe <jonas.ma...@elis.ugent.be> wrote:
Will global variables and static global arrays be always initialized to
zero?
Yes.

Then I suggest to amend the first paragraph of
http://www.freepascal.org/docs-html/ref/refse22.html
which directly contradicts this.

I have rather curious story behind this request.
In Russia, schoolchildren must pass "Unified State Exam" ("ЕГЭ" in
russian) upon graduation.
The exam on informatics includes requirement to write a simple program.
Currently, the program is allowed to be written in any programming language,
but it is written on paper, the pupil must precisely specify the language,
and the program is graded manually by teachers.

Some pupils wrote in Free Pascal, which is moderately popular in schools
(something around 20% IIRC). Several of them omitted initialization of
global arrays
based on the assumption that they will be zeroed automatically.
Those pupils were failed for that, and the graders stated that even if
current implementation
happens to zero global variables, this is not documented and so is merely
an implementation artifact which must not be relied upon.

Hence, this omission resulted in lower grades for some schoolchildren.
Very nice story!
-Laco.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to