From: Simon Wright <simon@pushface.org>
Subject: Re: CONSTRAINT ERROR? access check failed
Date: Thu, 01 Mar 2018 17:26:07 +0000
Date: 2018-03-01T17:26:07+00:00 [thread overview]
Message-ID: <lymuzriu6o.fsf@pushface.org> (raw)
In-Reply-To: ad65ac6f-a479-46bd-9f4c-a1c87ed938b3@googlegroups.com
Mehdi Saada <00120260a@gmail.com> writes:
> Work finished ! Thank you.
> But I would like to know why I get a warning at compile time with
> type Link (Num : LINE_NUMBER := 0; Length : NATURAL := 0) is
> record
> NEXT : access LINK := null;
> Line : String (1 .. Length) := (1..Length => ' ');
> end record;
> As if it could cause a stack overflow (was written as is). Yet I don't get at each compilation, surprisingly.
Because Length could be Natural'Last which would make Line large enough
to break the stack on any machine likely to be available to you.
Do you really need the default values? If you have defaults, then
creating an object of the type without specifying values for the
discriminants makes the discriminants changeable (by whole-record
assignment), so that sufficient space has to be reserved for the largest
possible record. Without defaults, you have to supply discriminants when
you create an object (the discriminants then can't be changed, but will
that matter?).
next prev parent reply other threads:[~2018-03-01 17:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 0:27 CONSTRAINT ERROR? access check failed Mehdi Saada
2018-03-01 8:07 ` Niklas Holsti
2018-03-01 12:44 ` Mehdi Saada
2018-03-01 13:45 ` Björn Lundin
2018-03-01 14:06 ` Mehdi Saada
2018-03-01 14:31 ` Mehdi Saada
2018-03-01 14:38 ` Mehdi Saada
2018-03-01 15:53 ` Anh Vo
2018-03-01 17:24 ` Mehdi Saada
2018-03-01 18:34 ` Anh Vo
2018-03-01 17:26 ` Simon Wright [this message]
2018-03-01 17:47 ` Mehdi Saada
2018-03-01 17:56 ` Jeffrey R. Carter
2018-03-01 8:30 ` Simon Wright
2018-03-01 12:14 ` Mehdi Saada
2018-03-01 13:27 ` Simon Wright
2018-03-01 13:44 ` Mehdi Saada
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox