Sujet : on changing paradigm of assign call
De : fir (at) *nospam* grunge.pl (fir)
Groupes : comp.lang.cDate : 01. Sep 2024, 16:15:37
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <ec5339abbc9920049b4f4b79a62ca2702df730e6@i2pn2.org>
User-Agent : Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
i tried to "design" well a function definition
and meed terrible stall i would say in thsi - dont know how to
do it though i think few years on this
(the probl;ematic is especially this returned values part)
as its go so hard i began to think if this paradigm of calls is not just wrong and some somewhat new idea come to me (though partially i was
thinking on it)
in fact i fint annoying this form
int x = foo()
annoying is especially this "=" sign as this is not quite assignment imo
other annoying think is thet you need to define x at all
and maybe this is a problem or its part
instead of
int x = add(2,3)
print(x)
maybe it should be
add(2,3)
print(add)
i mean the function name without the () should just represent the
return value so you no need to asign it
present c allows print(add(2,3))
but disalows to reuste it (and assign etc/et more
im close to think it definitely should
i mean
strlen("sjsbsjbhs"")
printf("%d", strlen)
obviously some names could maybe not fit like
find_character_position(txt, 'x');
>
print(find_character_position);
it should be moer lieke "found"
but i think it could be resolved by allowing to define this
int found find_character_position(char* txt, char c);
{
//...
// or return int found; //something liek that liek defining structure neme
}
then this found name should be avaliable to caller
so
find_character_position(txt, 'x');
if(found>=0)....
or
sumarize(2,3,3,2,2,3)
if(sum<10) ...
those function call asigments are probably some kind pf mistake
(though it looks a bit weird not to do that)