Deutsch   English   Français   Italiano  
<vodfv7$1aqmm$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: Two questions on arrays with size defined by variables
Date: Mon, 10 Feb 2025 19:19:19 +0100
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <vodfv7$1aqmm$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> <voaol9$o8ic$1@dont-email.me>
 <voapm4$oh21$1@dont-email.me> <voaq2u$ojms$1@dont-email.me>
 <vob4od$qdjb$2@dont-email.me> <vobmm7$tju0$1@dont-email.me>
 <vocl1c$157k1$2@dont-email.me> <vodem4$1akhl$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 10 Feb 2025 19:19:21 +0100 (CET)
Injection-Info: dont-email.me; posting-host="a8abafb157c3131ce8b7da00b79bd7fb";
	logging-data="1403606"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/+p11vJFlR5CxwXqu6g5+htsuCKh2QOVM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:wov6B3IVsit2UNP5UIrMH/DT9Vs=
Content-Language: en-GB
In-Reply-To: <vodem4$1akhl$1@dont-email.me>
Bytes: 2669

On 10/02/2025 18:57, Janis Papanagnou wrote:
> On 10.02.2025 11:39, David Brown wrote:
>>> [...]
>>
>> Let's assume your full code is :
>>
>> int main() {
>>    int n = 5;
>>    char * arr[n];
>>
>>    arr[99] = "foobar";
>> }
> 
> This assumption is incorrect (for my case), so all derived possible
> implications like
>>
>> In C, that means exactly the same as a do-nothing program:
>>
>>      int main() { }
>>
>> [...]
> 
> are meaningless.
> 

The details will of course be different because your code is different 
(you didn't show it, so all anyone can do is guess).  But the type of 
effects I described, and the way to get good information about your code 
and how it works, is valid for a wide range of code.  The fact that you 
think C does not have checks, and that you dislike that your erroneous 
code compiles and runs without you being informed of the errors, shows 
that you could benefit from the kind of suggestions I gave about good 
tool usage.

Understanding how to get the best from your tools is as important a part 
of software development as understanding the details of the language you 
are using.  You'd learn more about both if you didn't skip and snip 
useful help.