Truly portable C applications

31 pointsposted 15 hours ago
by signa11

18 Comments

Alifatisk

22 minutes ago

So am I getting this right? Cosmopolitian allows me to compile my code once, and run the same binary on every machine it supports? Is this a dream?

100ideas

7 hours ago

Very interesting comments and moderation discussion on this article.

h4ch1

5 hours ago

Decent article, why the need for someone to pick up the pitchfork and emphasize their moral compass publicly like this? The comment and ensuing discussion is so pointless.

Brian_K_White

4 hours ago

I think this point was valid: "she doesn't "stick to the technology""

The tech is cool. But the person who made it kicks puppies. You don't care? Well I do.

IncreasePosts

12 minutes ago

Ok, and I think it's insufferable how people like you infect every possible discussion with unrelated personal ideological concerns.

So, I guess feel free to keep bringing it up. That's your right. And I'll keep saying "holy shit shut the fuck up and discuss the content". Deal?

VyseofArcadia

2 hours ago

Why?

This makes sense in the case of, for example, a bestselling author who kicks puppies. Purchasing books by this author means you are giving them money, if indirectly, and thus to some degree subsidizing their puppy kicking habit.

That I can determine using APE gives the original author nothing.

SanjayMehta

4 hours ago

Werner von Braun comes to mind.

yawpitch

an hour ago

Wait, Werner von Braun kicked puppies?

cbm-vic-20

an hour ago

SS-Sturmbannführer von Braun, at best, looked away from the labor situation at the Mittelwerk complex that was building his rockets.

yawpitch

33 minutes ago

Yeah, sorry, I know that particular fascist’s history, but apparently sarcasm doesn’t drip as heavily on the Internet as I thought.

no_wizard

5 hours ago

Why do we pretend that these things don’t matter? Why should we?

Why in the norm to ignore these issues - there by perpetuating them because they face no consequences - rather than pointing them out?

Justine did write openly on the web about their prejudices and never even apologized let alone showed in anyway evolution away from fascist leaning and prejudiced politics

lelanthran

3 hours ago

I think I am missing a lot of context in this thread - I have no idea what any of the ancestral comments are talking about :-(

IncreasePosts

10 minutes ago

Please tell me how it matters.

What are you arguing here? Should no one use APE? Should people use APE but just feel bad every time they do? Should people use APE but never write about it for fear of aggrandizing the author?

p0w3n3d

7 hours ago

I have learned there is no true portability. Example: named pipes:

I started my professional career as a C++/Qt developer. There was this code to disallow multiple application instances using named pipes. It used named pipes under both Linux and Windows - just create a named pipe "my-program-pipe" and it was a signal for other starting up instances to communicate to it "please put the main app on top" and close.

On linux it worked like a charm. On Windows it worked like a charm...

...only first time. The code was written to "try create a named pipe and if failed - then it means it exists, so write to it instead and exit". This "try create" operation on windows failed but also removed the original existing pipe, thus allowing the third instance to coexist with the first one.

What I mean - Operating Systems are more than this, you cannot write a truly portable application without knowing them all. And especially those quirks that differ...

sjsdaiuasgdia

5 hours ago

Hence the Cosmopolitan Libc layer that's kinda essential to the APEs described in the article. That's where all the magic is to make the same code work on a variety of operating systems.

There's even a handy table to express syscall compatibility across all of Cosmopolitan's targets - https://justine.lol/cosmopolitan/functions.html

actionfromafar

5 hours ago

Your general point stands, of course. One can only code against a tiny subset of features. Windows has now finally gotten "real" named pipes, though. (Since Windows 8 or whenever, can't remember exactly when.)

Brian_K_White

4 hours ago

portability in a language is sort of like the right to persue happiness vs a garantee to be happy.

A language can't direct the rest of the universe to ensure that something always works regardless of the environment or context.

But it can avoid adding it's own limitations and be agnostic itself. So c is very portable, even though c on machine A has acces to machine A features and not machine B features.

Libraries and frameworks and standards just help a little for a few common cases but they are just travel power plug adapters, not pprtability.