10 ms·
You are replying to someone who builds C programs for 6 OS and 2 architectures without an #if ;)
by lovasoa 3y ago
You are replying to someone who builds C programs for 6 OS and 2 architectures without an #if ;)
- d6e 3y agoHow? I’d be curious if you have a blog post.
- kr0bat 3y agohttps://justine.lol/ape.html https://justine.lol/ape.html For the uniformed
- spockz 3y agoCan cosmopolitan replace the whole llvm toolchain required by GraalVM’s native-image? Currently cross building with native-image is a pain, especially compared to golang. (Or resource intensive as you need to compile it on each platform/architecture you want.)
- kaba0 3y agoIt’s probably not the best form to abstract away the OS-distinctions, as every abstraction will hide important details from the underlying OS. E.g. certain JDK native methods could be more efficiently done for, say, windows, then through a libc-like abstraction library.
- echelon 3y agoI love all of the domain experts and accomplished people hanging out with the rest of us on HN. :)
- rezonant 3y agoAlso for the casually dressed
- jamiek88 3y agoholy shit! > In the above one-liner, we've basically reconfigured the stock compiler on Linux so it outputs binaries that'll run on MacOS, Windows, FreeBSD, OpenBSD, and NetBSD too. They also boot from the BIOS. Please note this is intended for people who don't care about desktop GUIs, and just want stdio and sockets without devops toil they also boot from the BIOS.... does this mean that I can achieve my dream of booting straight into a BBC BASIC emulator on bare metal(ish)?
- DiggyJohnson 3y agoLove a great “do you know who you’re dealing with” HN moment. Justine’s APE [0] project is one of the few things to induce in me true, nostalgic, nerdful glee in the last few years. [0] https://justine.lol/ape.html https://justine.lol/ape.html
- f1shy 3y agoWow… some think Java is portable… this is so nice!
- digging 3y agoOk but sidenote, that Greek-letter titling is emotionally upsetting, even if the title is SR-accessible (κύδος for that though).
- violiner 3y agoYeah I read it as "Astmally pdrtable echesmtable". People shouldn't do this.
- IggleSniggle 3y ago"Astmally pdrtable echesmtale" is a very aesthetically pleasing name for what this, though. You just made me like it more...
- johnnyanmac 3y agoAhh geez. I see stuff like this going on in the background and I wonder what I'm even doing in my life, pushing pencils in comparison to actually, truly solving problems.I'd love to tackle more stuff like this, but I feel trapped chasing what I need to pay the bills (said pencil pushing). At the same time, companies seem so quick to layoff that I question how I even grow to the point where I'd be trusted with such problems. Do I really just need to do a 2nd full time duty in the open source community to get that growth?
- nvarsj 3y ago
- bigbillheck 3y agoI took a quick look at cosmopolitan.h: https://justine.lol/cosmopolitan/cosmopolitan.h https://justine.lol/cosmopolitan/cosmopolitan.h and counted 886 occurrences of "#if" (including #if and #ifdef)
- jart 3y agocosmopolitan.h is a concatenated rollup of hundreds of header files, shipped as part of the "amalgamation" variant of our release, and those sub-headers had #ifndef _FOO_H guards at the top and bottom. The rest of the #ifs are required by standards so we don't clobber the user's control of their namespace, e.g. `#ifndef _GNU_SOURCE`. What you won't see is the annoying stuff that checks for CPU, OSes, endianness, etc.
- yjftsjthsd-h 3y agoIn fairness, my understanding is that APE manages that by making the differences invisible to the application. I'm not sure whether that makes it more or less applicable. (More impressive, obviously, but not simpler)
- themerone 3y agoIt doesn't count if all your platform code is abstracted away by libraries.
- cdchn 3y agoThen you can appreciate how many #if macros it would save if you just targeted 1. ;)