[HN Gopher] My "retirement" project: Release 40 years worth of m... ___________________________________________________________________ My "retirement" project: Release 40 years worth of my "source code" Author : elvis70 Score : 393 points Date : 2023-11-03 17:26 UTC (5 hours ago) (HTM) web link (dunfield.themindfactory.com) (TXT) w3m dump (dunfield.themindfactory.com) | jart wrote: | I'm taking a look through DOSUTIL.ZIP and I love all these simple | elegant C programs. A lot of these programs somehow only manage | to have 1-2 standard c #include lines. How often do you see that? | I also love how, out of 20,000 lines of C code, there only exists | 24 #if statements. This is how C programming was meant to be. | Reading codebases like this is one of the things I drew | inspiration from when I started working on Cosmopolitan Libc. | duskwuff wrote: | > A lot of these programs somehow only manage to have 1-2 | standard c #include lines | | Older C compilers will let you get away with a lot of sins | which a modern C compiler will (correctly) call you out for. | jart wrote: | We can still get away with those sins today if you change C's | implicit type from int to long. I modified chibicc to do just | that it was a 1 LOC patch. Suddenly I didn't need prototypes | anymore and everything just worked without #include lines. | duskwuff wrote: | > Suddenly I didn't need prototypes anymore | | Under some very old C standards, maybe. But C99 requires | that you at least declare a function before calling it. | trealira wrote: | I haven't looked that deeply, but I don't see many sins in | this source code, either, except for the K&R style, weird | formatting and doing too much in one line, like this line in | the file CAT.C: if(*(Ptr = argv[i]) == '-') { | | Older C compilers did let you get away with more, like using | integers as pointers, and dereferencing pointers as though | they were struct pointers when they aren't. But I don't see | that in this code. | duskwuff wrote: | The "sin" I was referring to was calling undeclared | functions -- which is how there are so few #include | directives in much of this code. Most of the files I looked | at include <stdio.h> (probably required for variadic | arguments on printf-type functions) and <file.h> (for the | FILE type), and call other functions blindly. | trealira wrote: | That does make sense. My bad, I should have looked closer | and noticed the implicitly defined functions. | | It's not even a good idea to do that on modern computers, | because implicitly declared functions do type promotions | from float to double and char/short to int, and on the | System V ABI, it has to pass in the number of floating | point arguments there are in register eax. | jart wrote: | It's not a good idea to do that _in production code_. | FTFY. If you 're writing research, experimental, or one- | off programs then it can be a real productivity boon. I | say do it for fun. You have a right to enjoy yourself and | it'll still come out 10x more readable than Perl at the | end of the day, let's be real. | cdchn wrote: | If your build targets are 1 then that saves you a lot of #if | macros. | lovasoa wrote: | You are replying to someone who builds C programs for 6 OS | and 2 architectures without an #if ;) | kr0bat wrote: | https://justine.lol/ape.html | | For the uniformed | echelon wrote: | I love all of the domain experts and accomplished people | hanging out with the rest of us on HN. :) | DiggyJohnson wrote: | Love 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 | digging wrote: | Ok but sidenote, that Greek-letter titling is emotionally | upsetting, even if the title is SR-accessible (kudos for | that though). | violiner wrote: | Yeah I read it as "Astmally pdrtable echesmtable". People | shouldn't do this. | johnnyanmac wrote: | Ahh 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? | wahnfrieden wrote: | Go indie on the side then full time | LastTrain wrote: | This is great - add them to github! | megous wrote: | Or maybe don't feed the machine... | outside1234 wrote: | If it is not on Github it is never going to feed anything | quickthrower2 wrote: | A http server is all you need | TedDoesntTalk wrote: | ... which dies with the author, or a couple years later | when his domain expires. | EVa5I7bHFq9mnYK wrote: | Add $1000 to your Namecheap accounts, turn autorenew ON, | you are good for couple decades ... | cellularmitosis wrote: | The question of "how long would a non-famous repository | stay alive on github" is actually an interesting thought | experiment. | simonw wrote: | GitHub's track record on this so far is fantastic. Repos | that were created 15 years ago and didn't see another | commit since their creation are still there today. | pgeorgi wrote: | By this metric, folks should go for sourceforge: | https://sourceforge.net/p/gnome-napster/code/ has last | seen activity 23 years ago, while | https://sourceforge.net/p/primal/code/ci/master/tree/ saw | changes this year. | Diederich wrote: | What is the actual downside to hosting it personally | _and_ hosting it on github or something like it? | LastTrain wrote: | I do love personal websites - but the proper place for | sharing code, where it can be forked and shared, is GitHub or | a place like it. Plus, author has already licensed their code | in a way to allow it anyway. | fallat wrote: | > the proper place for sharing code [...] is GitHub | | Man how far people are brainwashed. | LastTrain wrote: | OK. Straighten me out. Explain the difference between | sharing my 20 year old code on a personal sever with a | license that says "do what you like" and posting my code | on GitHub/GitLab/SourceForge etc. | pgeorgi wrote: | There's also codeberg.org for git-shaped artifacts, or | archive.org for everything else. | screamingninja wrote: | > Or maybe don't feed the machine... | | Curious as to why you consider that a bad thing. | xeckr wrote: | Good idea. I should keep better track of all the stuff I've | written... | pbhjpbhj wrote: | elvis70 are you Dave Dunfield (the source author)? | | [It might be more a ShowHN if you are?] | | I'm interested if all of the code is self-written? If you wrote | any of it under contract and so had special terms to allow you to | eventually release it? Which piece of code there that you are | most proud of and/or gonna most useful? | jandrewrogers wrote: | I love this. It has crossed my mind more than once to do | something similar at some point in the future. | | This is a bit like receiving an inheritance from your | grandparents. There will be true gems and novelties mixed in with | a lot of knick knacks and rubbish. But the totality of that tells | a story of real people living rich and interesting lives that | only a handful of highlights would not do justice to. | albertzeyer wrote: | Why only when you are retired? Why not just right now? | VirusNewbie wrote: | Put it on github! You might actually get people to fork it and | continue working on it. | myself248 wrote: | That implies that it needs people to continue working on it. | | Is there no such thing as "done" anymore? | screamingninja wrote: | > That implies that it needs people to continue working on | it. | | It does not. | | > Is there no such thing as "done" anymore? | | Is there no such thing as "building upon it" anymore? | nihiven wrote: | This is really cool. It seems very 'pure' in comparison to what | my code history will look like. In 2040, a lot of my code will | show how I used a bunch of libraries and frameworks that nobody | uses 'these days'. This doesn't seem good or bad, just a | reflection of the times. | swatcoder wrote: | And unless you put in the effort to archive those dependencies | yourself, nobody may be able to truly read or build your code | anyway. | | Today's trendy development practices are shockingly ephemeral | and fragile. Very little of today's projects would survive one | decade left fallow, let alone four. | capitol_ wrote: | This is why I really like Debians policy of being self- | contained, that everything in Debian is built from sources | that are in the Debian system. | | It takes a lot more effort to package stuff, since you can't | just download your dependencies from the internet. But you | also create something that isn't as ephemeral. | trealira wrote: | Since you mention it, I recall that it's the same thing in | OpenBSD: their policy is "base builds base." | bluGill wrote: | A few years back my office threw away a PC running Windows XP | with no service packs. It was left in a closet for many years | just in case we had to fix a bug in some safety critical | code. | | A few years ago we tried to rebuild some safety critical code | from sometime back and were unable to because the | certificates had expired and so the machine that can build | the source code refused to connect to our version control | system. | xyst wrote: | > And unless you put in the effort to archive those | dependencies yourself | | go makes this extremely easy to do | | https://go.dev/ref/mod#go-mod-vendor | | rust tool chain also includes a vendor dependency process | | https://doc.rust-lang.org/cargo/commands/cargo-vendor.html | bbkane wrote: | Do you use this and check in vendored code? I don't, maybe | I should | fallat wrote: | > Today's trendy development practices are shockingly | ephemeral and fragile | | My fellow human, you have just nailed what is wrong with | today's software. | myth_drannon wrote: | all these `pip install` and `npm install` will be useless | myself248 wrote: | They already are, if your internet connection has a hiccup or | worse. | | They already are, if something has been hijacked and is now | malicious. | | They already are, if you need to install something offline | somewhere. | | They already are. | xyst wrote: | not sure if node has its own vendor process now | | But languages like go and rust have had the ability to | "vendor dependencies" for awhile now. | | Don't need an active internet connection. Just need to have | the toolchain. | outside1234 wrote: | Please put it on Github - nobody will ever find this otherwise | 38 wrote: | It's on the front page, so your comment seems pretty tone deaf. | outside1234 wrote: | For today -- and tomorrow everyone forgets about it. | thecyborganizer wrote: | From STYLE.TXT: - True=7 - Having lots | of very low-level code and hardware experience, I developed a bit | of tendancy to "minimize what can go wrong at low levels" - C | treats 0==FALSE and !0==TRUE - most people use 0/1 ... but | thats only 1 bit "difference". I sometimes use 7=TRUE as | thats 3 bits with no more chars to type (and of course | foolish as such a 1 bit hardware error would "trash" pretty much | any system - but I do tend to be a creature of habit :) | | I have never heard of this convention before! Was "random | bitflips messing with your conditionals" a common problem back in | the day? | wrs wrote: | I've been involved with systems where 0xffff... was canonical | "true", but not something as specific as 7! If you're going to | turn on more bits, why not all of them? Though I think this was | because the NOT instruction was used for logical inversion, so | the bit flip theory doesn't apply. | cpeterso wrote: | For example, the value of Visual Basic's "True" keyword is | -1. This seems silly from the perspective of a C programmer, | but -1 (0xffffffff) is "more true" than 1 because every bit | is true, not just the LSB. :) | | https://learn.microsoft.com/en-us/dotnet/visual- | basic/langua... | bilekas wrote: | Even in VB there is a grain of rationale .. I never even | considered before WHY it was -1.. I always just thought it | was VB doing VB, but now I have gained +1 respect for Vb.. | | Edit: "Gained" no "Earned" | marssaxman wrote: | In the long-ago world where integers were commonly used as | arrays of bit flags, it made perfect sense that True = Not | False. | layer8 wrote: | The OP still wanted to only type a single character. | jareklupinski wrote: | tangential to 'how can a bit be wrong', when trying to see if a | serial data line is working, i write 0xA5 ( 1010 0101 ) to send | an alternating bitstream with a twist so i can test the | greatest number of things i think can be wrong at once | genter wrote: | Except that if you have the bit endian wrong, 0xA5 is the | same forward and backward. | jareklupinski wrote: | that's true! 0xAA 0x55 would work to differentiate that | case? | MadnessASAP wrote: | Yes, AA and 55 are common test patterns for a variety of | hardware. | | Haven't seen A5 in the wild but I suppose it could be | useful as a initial "Let's setup a connection" where | endianness is unknown. Assuming the next thing that is | exchanged is an endian negotiation. | dboreham wrote: | No. Random bitflips (aka hardware that doesn't work) are a | relatively new thing. Bit flips due to buggy software was a | thing though. This is why most database engines checksum the | payload data even in memory. I've also seen network packets | corrupted because a bridge (former name for switch) trashed | data in flight, then reconstructed its CRC for the corrupt data | on the onward leg. | dvaletin wrote: | What you mean by relatively new? I observed bitflips a couple | decades ago, causing machine to panic. | bernds74 wrote: | I beg to differ. Early 90s there were some Amiga memory | expansions that would constantly flip bits. I'm pretty sure | it contributed to the sentiment that the system wasn't the | most stable, although I'm pretty sure one or two of my | friends with PCs saw similar issues on their machines. Maybe | Microsoft Word wasn't to blame for all the crashes? | | Of course, trying to work around it in software is utterly | futile. | ziddoap wrote: | > _Random bitflips (aka hardware that doesn 't work) are a | relatively new thing_ | | This implies that old hardware _always_ worked, which I | strongly doubt (what year did hardware go from always working | to not?). | anonymousiam wrote: | SEE/SEU are not a relatively new thing. However, the | frequency of events is inversely proportional to the feature | size, which has been decreasing over time. | | https://en.wikipedia.org/wiki/Single-event_upset | | https://en.wikipedia.org/wiki/Die_shrink | egometry wrote: | Still is. And there's little to be done about it. | | Unless you can stop cosmic rays. | | Luckily it doesn't happen THAT often. I forget the exact metric | but I recall various Google Engineers saying that something | like one out of a million test run failures is a random | bitflip? | eichin wrote: | Cosmic rays were a _theory_ in 70 's era hardware for | failures that ended up being proven to be particles emitted | by the ceramic packaging itself. (Modern bitflips are have | more to do with component sizes several orders of magnitude | smaller.) (edit: not saying that cosmic rays aren't a problem | _now_ , just that they only _became_ a problem as chip | element sizes shrunk, _and_ they 're probably not the only | source.) | | Also, you can definitely stop cosmic rays, that was part of | how they eliminated them as the source. | Supermancho wrote: | > Also, you can definitely stop cosmic rays | | As I understand it, bit flipping in RAM is mitigated by | error correction, via auxilliary and redundant bits. | | https://en.wikipedia.org/wiki/Dynamic_random- | access_memory#R... | buildbot wrote: | I swear there was a google paper about using a DC as a | really bad particle detector, but I can't find :/ | scottlamb wrote: | > I have never heard of this convention before! Was "random | bitflips messing with your conditionals" a common problem back | in the day? | | Due to RAM/CPU failures? I don't think so (though I have seen | it, fwiw). With weird serial protocols that don't have proper | checksums/digests, running over sketchy wiring? Yeah, and that | might be part of "very low-level code and hardware experience". | layer8 wrote: | No, this is more a case of "this could conceivably happen, so | why not guard against it where it's easy to do". Though | personally I would have used -1. | AnimalMuppet wrote: | To the degree that you were worried about such things, this | wasn't a real answer. Yes, it saves you if you have a boolean | variable... maybe? if (var == TRUE) ; | // It was 7 else if (var == FALSE) ; // it was | zero else ??? what do I do here? | | And you need to solve that "what do I do here" for _every | single conditional on a boolean_ , and have the extra lines of | code to handle it and not crash. | | But, you know, what if it was a variable that you used in a | switch statement instead? Or just "if (i > 17)"? Bit flips can | affect your logic all over the place, not just when it's a | boolean variable. | | And then, if a bit flip can affect a boolean, it can also | affect a pointer. Or the return address on the stack (or the | link to the previous stack frame). | | Or it can flip a bit in the code. | | So this is, at best, a very very partial solution, and it's | non-trivial to implement. So this was very much not standard | practice or a "convention". | LordShredda wrote: | if var is neither this nor that then it's not a boolean | myth_drannon wrote: | I like to download images of old programming CD's from | archive.org, like Programmers Heaven[1] for example. All small | and interesing programs/tutorials to look at. | | [1] | https://archive.org/details/Programmers_Heaven_InfoMagic_Mar... | TMWNN wrote: | Vernor Vinge's _A Deepness in the Sky_ depicts a human society | thousands of years in the future, in which pretty much all | software has already been written; it 's just a matter of finding | it. So programmer-archaeologists search archives and run code on | emulators in emulators in emulators as far back as needed. | <https://garethrees.org/2013/06/12/archaeology/> | | You've made a contribution to the hoard that someone will benefit | from, whether tomorrow or in 5,000 years. | egometry wrote: | The part about the modern (read: far future) calendar being | commonly thought to be based on mankind's first moon landing | but ACTUALLY being based on the Unix Epoch is a favorite | amoungst engineers I know that love Vinge | ceva wrote: | why not somewhere on git? :(? | jhallenworld wrote: | I think his most impactful utility is ImageDisk: used to archive | floppy disks from many different types of computers using IBM | PCs. | | Much of the old software found on bitsavers.org (and archive.org) | was recovered using this utility. | razster wrote: | Another link from DDS is Dave's Old Computers | http://dunfield.classiccmp.org/ , a nice treasure of old pc | reviews and images, (Left, right, front and back). This is | amazing as I've been working on making 3D assets for a project of | mine. | JaDogg wrote: | Very nice. Hope you enjoy your retirement. | | ---- | | One last bugfix before retirement (this is a joke): | | I wanted to look at micro-cad it generates a 404. | | URL: https://dunfield.themindfactory.com/dnld/sc/MICROCAD.ZIP | Expected: I can download the .zip file. | bilekas wrote: | This is brilliant.. It's so interesting too because over the | years I've built up a few "Bibles" that I always need on hand | when working in a particular language or even just automation, | I've learnt some very good organising processes (from HN to be | honest), I never thought to 'release' them as they feel quite | personal and specific for my mental process. | | Looking through some of these though, I think I'm inspired. Super | cool idea, I would donate to the retirement project financially | to say thanks if possible. | varjag wrote: | I regret not archiving my early code for good so much. First non | trivial program (a snake game). First utility in assembly. First | device driver (for a Centronics printer). That perpetual calendar | in Pascal for a uni assignment, written with enormous hangover | within an hour and still my only program written entirely bug- | free to the date. All seemed trivial and not worthy of | preservation then but in the end I have no code surviving from | before late 1990s. | | Take good care of your code kids! | ai-epiphany wrote: | thanks for the tokens | bilekas wrote: | Quick question because I can't actually find any info on it, but | what license are these released with ? | fallat wrote: | Did you seriously even look at the webpage? | https://dunfield.themindfactory.com/dnld/sc/COPY.TXT It's right | at the top man. | nick238 wrote: | Though because that license says "for any reasonable purpose" | it's something that's vague when it comes to "is this FOSS" | as it's vaguely Crockford-like ("this software shall be used | for Good, not for Evil"). | | The [OSI requires](https://opensource.org/osd/): | | > 6. No Discrimination Against Fields of Endeavor > The | license must not restrict anyone from making use of the | program in a specific field of endeavor. For example, it may | not restrict the program from being used in a business, or | from being used for genetic research. | | [GNU/FSF](https://www.gnu.org/philosophy/free-sw.html) have | as "Freedom 0": | | > The freedom to run the program as you wish, for any purpose | bilekas wrote: | So honestly I didn't read the "COPY.TXT" .. I wouldn't expect | a license to sit there, and I didn't consider that a license | personally, I was expecting a defined license. | jcmoscon wrote: | You have the same name as the billionaire guy. Are you him? :) | accrual wrote: | I downloaded RINGSW.ZIP to check it out. | | > This file is NOT included in the demo version of this product. | | > For more information, please contact Dunfield Development | Systems | | I admire the effort, but if you're not going to make the source | freely available, what's the point? What is somebody going to do | 100 years from now when they get your .zip off archive.org and | you're long gone? | asdefghyk wrote: | THere are reasons not to host on GitHub . There are workarounds | to hosting on GitHub Google words why not put software on git hub | Finds https://sanctum.geek.nz/why-not-github.html OR | https://www.wired.com/2015/06/problem-putting-worlds-code-gi... ___________________________________________________________________ (page generated 2023-11-03 23:00 UTC)