Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

here

18 views
Skip to first unread message

fir

unread,
Sep 21, 2021, 5:59:24 AM9/21/21
to
i was not doing c long time but its autumn again and i thinkd,:maybe i do some

i put in some abstract thought that "jumps" in program allows for branching (if conditional) and loops but do they allow the function call?

this led me immediately to note maybe somekind like hole in c (or
something like that) : to make function call one would just need to
store current program pointer (so called IP (instruction pointer) basic
fundamental thing in old 6510 assembly when i was starting to coding)

c has a type of void* to store that ipo but has no way of reading current
state of it... this could be made (become realized (? not sure this english phrase, "byc zrealizowane") by some construct/keyword like 'here'

for example

void* where1;
void* where2;
void* where3;

void foo()
{
where1 = here;
b();
where2 = here;
c();
where3 = here;

goto where2;

}

i not thinked on eventuall usability of this but the lack of this here mechanism seem to be a logical hole for me...usability probably could be found


fir

unread,
Sep 21, 2021, 6:16:01 AM9/21/21
to
wtorek, 21 września 2021 o 11:59:24 UTC+2 fir napisał(a):
> i was not doing c long time but its autumn again and i thinkd,:maybe i do some
>
> i put in some abstract thought that "jumps" in program allows for branching (if conditional) and loops but do they allow the function call?
>
> this led me immediately to note maybe somekind like hole in c (or
> something like that) : to make function call one would just need to
> store current program pointer (so called IP (instruction pointer) basic
> fundamental thing in old 6510 assembly when i was starting to coding)
>
> c has a type of void* to store that ipo but has no way of reading current
> state of it... this could be made (become realized (? not sure this english phrase, "byc zrealizowane") by some construct/keyword like 'here'
>
> for example
>
> void* where1;
> void* where2;
> void* where3;
>
> void foo()
> {
> where1 = here;
> b();
> where2 = here;
> c();
> where3 = here;
>
> goto where2;
>
> }
>

i know some coud say c has labels and you may turn where1=here; intu just where1: (and goito where1;)
which also would spare of sorta idiotic re-storing of where1 to here which is always the same value (in typical environment) but in case i was thinking initially i mean when someone would like to make function calls with jumps

ret_addr = here+(l2-l1);

l1:
goto foo;
l2:

///in foo
/// goto ret_addr

it makes some complications but at least allows this ...and this hole (lack of iot) in c may not be big practically
but theoretically is kinda big hole probably



fir

unread,
Sep 21, 2021, 6:23:57 AM9/21/21
to
wtorek, 21 września 2021 o 12:16:01 UTC+2 fir napisał(a):
> wtorek, 21 września 2021 o 11:59:24 UTC+2 fir napisał(a):
> >
> i know some coud say c has labels and you may turn where1=here; intu just where1: (and goito where1;)
> which also would spare of sorta idiotic re-storing of where1 to here which is always the same value (in typical environment) but in case i was thinking initially i mean when someone would like to make function calls with jumps
>
> ret_addr = here+(l2-l1);
>
> l1:
> goto foo;
> l2:
>


some could point that

ret_addr = l2;
goto foo;
l2:

would suffuice, this is also true but still teh lack of here is some hole of completion

it may also be notet that goto with argument passing could be used

goto foo(l2);
l2:

and this may be seen as 'deconstruction' of function call on elements which is also good imo
0 new messages