| Deutsch English Français Italiano | 
| <vobna3$tmev$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article | 
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: Re: Two questions on arrays with size defined by variables
Date: Mon, 10 Feb 2025 03:12:18 +0100
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <vobna3$tmev$1@dont-email.me>
References: <vo9mns$gsd7$1@dont-email.me> <vo9nn3$gtph$1@dont-email.me>
 <vo9u0u$i0n8$1@dont-email.me> <voae3a$2rke4$1@paganini.bofh.team>
 <voao29$o6uh$2@dont-email.me> <87bjvar83h.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 10 Feb 2025 03:12:19 +0100 (CET)
Injection-Info: dont-email.me; posting-host="9a53b9bbf9924f168baa28a2e377f8a7";
	logging-data="973279"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+3TsggPykUg7eMpMM6U/2c"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:3IEpBZnpRnQl1QxnqmrGTFEoKGw=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <87bjvar83h.fsf@nosuchdomain.example.com>
Bytes: 2757
On 10.02.2025 00:50, Keith Thompson wrote:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> [...]
>> I had other languages in mind.[*]
>>
>> Janis
>>
>> [*] For example Simula:
>>
>> begin
>>     integer n;
>>     n := inint;
>>     begin
>>         integer array arr (1:n);
>>         arr(5) := 9;
>>     end
>> end
>>
>> (Which is also understandable, since in Simula declarations must appear
>> before statements in any block.)
> 
> Apparently Simula doesn't allow variables to be initialized in their
> declarations. 
The Cim compiler I use actually supports a constant initialization -
but I'm positive this is non-standard! - like
begin
    integer n = 10;
    integer array arr (1:n);
    arr(5) := 9;
end
> Because of that, `n := inint;` (where inint is actually a
> call to a value-returning procedure) is a separate statement.  If
> Simula supported C-style initializers, then presumably the inner block
> would not be needed:
Indeed. (See non-standard example above.)
> 
>     begin
>         integer n := inint;
>         integer array arr (1:n);
>         arr(5) := 9;
>     end
> 
This is not possible because 'n' isn't a constant here (and 'inint' is
a function, as you say). - So you're correct that the block would not
be an inherent necessity for that declaration [with Cim compiler].
A general statement for the standard Simula language cannot be given,
though, since it's undefined.
Janis