Deutsch   English   Français   Italiano  
<178cc83837030c1ac9ff3e06d703d9c20a83fb96@i2pn2.org>

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

Path: ...!weretis.net!feeder9.news.weretis.net!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail
From: fir <fir@grunge.pl>
Newsgroups: comp.lang.c
Subject: Re: on allowing "int a" definition everywhere
Date: Tue, 27 Aug 2024 11:52:03 +0200
Organization: i2pn2 (i2pn.org)
Message-ID: <178cc83837030c1ac9ff3e06d703d9c20a83fb96@i2pn2.org>
References: <afdfe7c37c6ad739fd82c7ec0587b82e0963fce2@i2pn2.org>	<va3n09$3nnl8$1@dont-email.me>	<f693bfded5f8fec712a445d88ebe34419e0f7072@i2pn2.org> <vajt3u$2so1b$2@dont-email.me> <7ea05965a67fa09d4ebd0b6ec53109dcb0b12f76@i2pn2.org> <3775b5abd14443f89852e05177a44bd72585cbdd@i2pn2.org> <4c7a695b1b755393162a1ae36ea6306760ffe949@i2pn2.org> <6c3ace23167948673b9d9314caeaf86ab9c2ffd6@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 27 Aug 2024 09:52:03 -0000 (UTC)
Injection-Info: i2pn2.org;
	logging-data="4081031"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
In-Reply-To: <6c3ace23167948673b9d9314caeaf86ab9c2ffd6@i2pn2.org>
X-Spam-Checker-Version: SpamAssassin 4.0.0
Bytes: 4201
Lines: 118

fir wrote:
> fir wrote:
>> fir wrote:
>>> fir wrote:
>>>> Lawrence D'Oliveiro wrote:
>>>>> On Sun, 25 Aug 2024 12:40:39 +0200, fir wrote:
>>>>>
>>>>>> Lawrence D'Oliveiro wrote:
>>>>>>
>>>>>>> Somehow along the line from BCPL to B to C, one useful feature was
>>>>>>> lost: the ability to have a value-returning statement block
>>>>>>> inside an
>>>>>>> expression.
>>>>>>>
>>>>>> if so thats probably sad, though i dont know how it looked like
>>>>>
>>>>> The construct looks like
>>>>>
>>>>>      VALOF $( ... «stmts»; RESULTIS «return-value» $)
>>>>>
>>>>
>>>> it is good to things return value and good to be able to combine it
>>>>
>>>> as i sait for example i consider such loops
>>>>
>>>> 10'x   //ten tiem execute x
>>>>
>>>> print (10'x+=x)/10
>>>>
>>>> would be equivalent of
>>>>
>>>> for(int i=0; i<10; i++) x+=x;
>>>> print(x/10)
>>>>
>>>> (and its still c, just with shorted syntax not python et sort)
>>>>
>>>>
>>>
>>> as to this loop as i said i had no ide how to make indexes like i
>>> in this form but what comes to my mind now is maybe something lika
>>>
>>>
>>> 10'print("x")
>>>
>>> 10i'print(i)
>>>
>>>
>>> 480y' 640x' set_pixel(x,y, 0xffff00)
>>>
>>> those i,x,y  in loop 'headers' could be possibly subscripted
>>> like 2 in typical H20 (2 is subscripted
>>>
>>> eventually one can go
>>>
>>> 10'  print((x 0)++)
>>>
>>> where x 0 is initialisation of int x to zero
>>>
>>>
>>
>> overally not bad, i could somewhat accept that loop
>> (yu wouldnt belive how hard is come to that syntax conclusions,
>> literally takes years, and not 5 years more like 15)
>>
>>
>
> its digression but still i got problem what to do with
> function definition esp returning values
>
>
> take for example div(11,5) function which returns 2 (11/5) as
> a main result but should also eventually return 1 (11%5) as a second
> prt of result
>
>
> the thinking is now maybe something like that (if using old syntax)
>
> int div( int a,  int b)
> {
>     static int result = a/b,
>     static int remainder = a%b
>
>     return result;
>
> }
>
> x = div(20/7);  //gives result
>
> x y = (result, remainder) div(20/7);  //gives both
> x y = (remainder, result) div(20/7);  //gives both but in different order
> y = (remainder) div(20/7);  //gives only the remainder
>

also could be used in fact with builtin operators

x = (remainder) 100/9;
x = (carry) 100+229;
x = (zero) 100+229;
x = (sign) 100+229;

etc (as such operator call could be understand as set some of its inner 
local variables)



>
> could also be used to skip a part of results
>
> v2 = (x,y) cross(A,B) //when full result is x y z
>
> also imo a given function if longer could ghave a bumch of local
> variables and this way you eventually acces set of some you want so
> it may be handy
>
>
>
>
>