Quick update

10 views
Skip to first unread message

The Beez

unread,
Sep 10, 2021, 4:52:18 AM9/10/21
to 4tH-compiler
Hi 4tH-ers!

I'm easily distracted - but in the end work gets done eventually. I've learned to always follow these "obsessions", because it keeps it fun (instead of feeling like work) and it gives me the motivation to pursue things. So - sorry for that.

I've recently viewed a couple of video's from the excellent Jacob Sorber channel on YouTube and he got me into the popen() issue once again.

I've never been completely happy with it. I ASSUMED that it was a standard C function - but it's POSIX and its support outside the *nix family of OS-es is flaky. Yes, Windows got it, but all in all it's a mess of conditional compilation stuff.

The point is - when the pipes are open it will happily return a file pointer. But in the meanwhile it may fail because the command may not exist. So I kind worked around it, testing the process before returning the pointer. If you never noticed that - I've done it right.

The video I saw suggested that "errno" would be set on a failed call - so I tested that one. But it turns out, errno is ONLY set when the shell returns an error. Yeah, you read that correctly. 4tH forks, opens a shell and THEN calls the command. And it's the latter that bothers me, so "errno" carries no additional information for me.

Probably, if opening the shell returns an error, you got a lot of other problems on your hand. So - for me there is nothing to fix. Kind of wasted time, although I now have a better understanding of the mechanics behind it. Or I forgot all about it, which is possible too ;-)

Now, I still got some minor beef with uBasic. But that's another story. If it works out, I will let you know.

Hans Bezemer

The Beez

unread,
Sep 13, 2021, 10:40:17 AM9/13/21
to 4tH-compiler
BTW, I tried a new variant for CircleSort as well. And although it sorted fine, over 512 elements the performance deteriorated quickly.

Hans Bezemer

parcirc.c
Reply all
Reply to author
Forward
0 new messages