[HN Gopher] As I retire, my goal now is to release 40+ years of ...
___________________________________________________________________
As I retire, my goal now is to release 40+ years of source code
Author : elvis70
Score : 1026 points
Date : 2023-11-03 17:26 UTC (1 days 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.
| billfruit wrote:
| But why does it have to be that way though, can't the
| compiler scan the rest of the code/files and see if a
| defenition/declaration is present somewhere?
|
| There is no such requirement of a declaration before
| first call in Java for example?
| rezonant wrote:
| It's because the C compiler was designed to be single
| pass, so as to be speedy and require less memory on the
| systems of it's time.
| dheera wrote:
| I suppose you could just create a ".d" file standard that
| doesn't have that requirement but processes into a ".c"
| file that has the necessary prototypes. You could
| probably also auto-insert all the #if'n'def nonsense
| automatically and skip it in the ".d" files.
|
| Kind of like how the JavaScript dudes all use this ".ts"
| stuff now for convenience that processes into ".js"
| foodevl wrote:
| The Arduino build system does this (preprocesses your
| source code to pull out prototypes and put them at the
| top). To make things easier for beginners.
| billfruit wrote:
| Is that a requirement that is relevant presently? I would
| say not so much. Do modern C compilers also make only a
| single pass?
| hulitu wrote:
| Yes. Gcc throws errors like hell with c files which have
| the definitions after functions.
| rezonant wrote:
| Modern compilers still have to follow the rules of the
| language.
| fuzztester wrote:
| Like early Pascal compilers, or maybe all of them. Don't
| know about the latter case (all).
| Gibbon1 wrote:
| What I understand is the preprocessor causes issues where
| you could do that maybe 99.9% of the time, especially
| with well written code. But it'd fail that 0.1% of the
| time.
|
| You do have analyses like ctags. In theory the compiler
| could use ctags to find definitions in source code. My
| experience is ctags can get confused. It's possible in a
| set of files to have multiple implementations of a
| function and ctags can't tell which one is used. And I
| see cases where it can't find definitions.
|
| Personally I'd be happy if the compiler tried to find a
| missing definition using ctags and issued a warning.
|
| I have wondered if adding funct, public, private keywords
| to the language might allow the compiler to reliably find
| function and stuct definitions in source files.
| fuzztester wrote:
| Good question.
| reactordev wrote:
| The fact that I'm calling a function, it must exist,
| otherwise the compiler will throw an error ("undefined
| reference to function"). So forward declarations is just
| needless typing.
| duskwuff wrote:
| > The fact that I'm calling a function, it must exist
|
| That's not _necessarily_ true. It 's possible that the
| symbol is a function pointer; calling a function pointer
| requires slightly different code generation. Compare the
| generated code between: void fn(void);
| void call_fn(void) { fn(); }
|
| and void (*fn_ptr)(void); void
| call_fn_ptr(void) { fn_ptr(); }
|
| In practice, it's probably a function, and that's what
| the compiler assumes if there's no declaration to go off
| of. But we all know what happens when you make
| assumptions.
| reactordev wrote:
| Making no assumption on safety, just stating that forward
| declarations are superfluous.
| fsckboy wrote:
| no they are not. but > _The fact that I 'm calling a
| function, it must exist, otherwise the compiler will
| throw an error ("undefined reference to function")_
|
| you mean the linker will throw an error. The linker is
| trying to link together the "references" be they forward
| or backward, that the compiler has created, and the
| compiler needs to have generated the right references,
| round peg round hole, square peg square hole.
|
| You don't want your linker throwing errors, it doesn't
| have the context the compiler does; and you don't want to
| turn the linker into ChatGPT that can converse with you
| about your source code, just use the C version of forward
| references which are not particularly forward, they just
| say "I don't know where this is defined, it's just not
| defined here, but we know it's a square peg"
|
| For example, there are architectures where space is tight
| (embedded for example) and nearby things can be called
| more efficiently than far away things, so the compiler
| needs to generate as many near calls as it can, falling
| back to far away when it has to. It doesn't know in
| advance how far away things are going to be, but it might
| uncover plenty of near things as it goes. Square pegs,
| round pegs.
|
| when you recompile your project code, the library code,
| is not necessarily around. When other people recompile
| their library code, your project code isn't around.
| What's the size of what's being put on the stack? Still
| gotta get the square/round pegs right.
| reactordev wrote:
| I know _why_ it exists. It's still superfluous to most
| use cases. Don't force me. Require it when you can't
| figure it out.
| fuzztester wrote:
| "long far pascal", et al, anyone?
|
| Win32 C code from way back.
|
| Heh.
| saagarjha wrote:
| The compiler needs to see it to know how to call it.
| reactordev wrote:
| In which case, it needs to keep parsing the include tree
| until it finds it. I know _why_ it exists. I'm just not
| happy about duplicating code. Other compilers are smarter
| than this.
| duskwuff wrote:
| If you're using a modern IDE, clangd can be configured to
| automatically insert #include statements (--header-
| insertion=iwyu).
| jart wrote:
| > C99 requires that you at least declare a function
| before calling it
|
| Where is that written? Please quote the standard. My
| reading of ISO/IEC 9899:TC3 is that Foreword says
| (paraphrasing) "hey, we _removed_ implicit int and
| implicit prototypes from the standard ". So they simply
| stopped specifying it, but as far as I can tell, the
| standard says nothing about forbidding them. From my
| point of view, that means compilers are free to still
| implement implicit types as a compiler extension to the
| language, and everyone does, because that extension is
| needed in order to support the older c89 standard. It
| would only impact people who want to be able to claim
| their codebase is c99 standard compliant, because you
| can't do that if you depend on compiler extensions.
| kevin_thibedeau wrote:
| Prototypes are required in C23 as part of the expungement
| of K&R syntax. This also brings harmonization with C++
| where an empty parameter list is implicitly void.
| duskwuff wrote:
| > Where is that written?
|
| ISO/IEC 9899:TC3 [1] SS6.5.1 P2: "An identifier is a
| primary expression, provided it has been declared as
| designating an object (in which case it is an lvalue) or
| a function (in which case it is a function designator)."
|
| There's even a footnote to underscore this point: "79)
| Thus, an undeclared identifier is a violation of the
| syntax."
|
| [1]: https://www.open-
| std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
| fuzztester wrote:
| Pascal had a forward declaration from way back, even
| before Object Pascal:
|
| https://en.m.wikipedia.org/wiki/Forward_declaration
|
| https://en.m.wikipedia.org/wiki/Pascal_(programming_langu
| age...
|
| https://en.m.wikipedia.org/wiki/Object_Pascal
|
| https://www.thedelphigeek.com/2017/03/forward-record-
| declara...
| eVeechu7 wrote:
| A little bit of advice like that is a tremendous blessing
| to those of us who just need to touch C occasionally.
| 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.
| rezonant wrote:
| > it'll still come out 10x more readable than Perl at the
| end of the day, let's be real.
|
| A low bar, really :-P
| queuebert wrote:
| Wait til you see old Fortran codes.
| fuzztester wrote:
| >Older C compilers did let you get away with more, like
| using integers as pointers
|
| In older C compilers (maybe pre-ANSI, or later, can't
| remember), you could literally write i[a] instead of a[i],
| where a was an array and i was an int, and it would work
| equivalently, i.e. no compiler error, and give the same
| result as a[i]. This was because a was the address of the
| start of the array, and i was an offset, so a[i] actually
| meant *(a + i), which, by the commutative property of
| arithmetic, was equivalent to *(i + a), which was
| equivalent to i[a].
|
| I had read this in some C book, maybe K&R or the Waite
| Group C Microsoft Bible.
|
| Never forgot it, because it was counter-intuitive, unless
| you knew the above reason.
|
| And tried it out in one or more C compilers at that
| approximate period, and it worked as stated.
| flykespice wrote:
| Hmm implicit int conversion
| 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. :)
| rezonant wrote:
| Also for the casually dressed
| jamiek88 wrote:
| holy 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)?
| arendtio wrote:
| You might want to take a look at the current no. 2 of the
| HN best list:
|
| https://news.ycombinator.com/item?id=38101613
| jamiek88 wrote:
| thank you so much!
|
| Justine is a genius.
| spockz wrote:
| Can 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 wrote:
| It'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.
| 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.
| IggleSniggle wrote:
| "Astmally pdrtable echesmtale" is a very aesthetically
| pleasing name for what this, though. You just made me
| like it more...
| 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
| johnnyanmac wrote:
| I've definitely thought about it and I imagine it's my
| end game. But I'm hesitant if I'm truly ready and have
| the right skills for that. Would that self growth be
| better than contributing to something larger first
| (perhaps building more connections on the way)?
| reactordev wrote:
| any skills you lack you can hire for. Do it!
| wahnfrieden wrote:
| Contributing to OS I'm not sure what that's a path to
| exactly
| johnnyanmac wrote:
| There's Many intentions behind it. In rough order of
| importance;
|
| - working on a medium-large repo size exercises more
| skills than just jumping into anything alone. Growth is
| my biggest factor for the next few years.
|
| - OS introduces me to a community of passionate devs. Who
| can be anything from mentors to expand my horizons, to
| friends to future contacts.
|
| - I'd choose to contribute to tools I would probably use
| for my own projects. So I can dig into repos early and
| know it intimately for the time I'd need to branch for my
| own project
|
| - potential clout in certain communities can open other
| doors.
|
| - Resume material is never bad if everything else falls
| through
|
| It's not my end game but I think it'll help in many ways.
| And Personally I always had a certain respect for the OS
| community and want to give back, and hopefully pay if
| forward. .
| wahnfrieden wrote:
| Good luck. Most OS contribution is thankless and leads
| nowhere so be careful with your time and timidity
|
| I contribute to repos I use in my projects, but I'd never
| start with them before actually finding a use for them
| johnnyanmac wrote:
| I'll keep that in mind. Maybe it will be yet another
| venture of "I want to connect with people but no one else
| does" but nothing ventured...
|
| And it would be a soul crushing world if I simply
| submitted to the fact that we're more connected than
| ever, but simultaneously I can't find literally anyone
| else to connect with without money being involved. I have
| at least a good decade in my heart left to fight that
| mentality.
| wahnfrieden wrote:
| Make money (without wages), then you have ownership of
| your time for pursuing interests
| johnnyanmac wrote:
| That's the hopeful end goal. I unfortuntately need a lot
| of time and learning to make a product worth paying for,
| though. being self-sufficient is liberating but
| terrifying unstable in the beginning. Need to establish
| proper safeaguards first.
| NetOpWibby wrote:
| At some point, you're just gonna have to go for it. Jump
| in and see what happens.
| rebolek wrote:
| If you don't try, you'll never find out.
| nvarsj wrote:
| The perpetual inner turmoil for talented engineers :). I
| accepted a while ago that there's more to life than
| coding and career, so I don't do much outside of work -
| 40-50 hours a week of engineering is enough for me. But I
| try to focus on getting the best job possible that fits
| what I like to do.
|
| Obviously spending 20+ hours a week on interesting OSS is
| going to get you more interesting roles over time, and
| generally OSS stuff is way more fun because you can pick
| what interests you. But you have to decide if it's worth
| the cost - do you really want to spend 60 hours+ a week
| just doing coding / engineering? Maybe you do, but in
| that case you'd probably be doing it already.
| sadhorse wrote:
| If you are not living the life you want then you are a
| failure. Face the reality of your situation. While others
| do what they want you do what you are "supposed" to do,
| and you know how this feels. Good luck.
| sgu999 wrote:
| > If you are not living the life you want then you are a
| failure.
|
| What a rude and profoundly dumb statement. Are all the
| ones who bust their arses out of necessity failures or do
| they simply want to endure pain? Caring for a handicapped
| child, parent, being trapped in a poor country, etc.
|
| I'd be curious to know where most of you around here who
| put desires above all else are coming from.
| sadhorse wrote:
| I don't understand where you are coming from. I've met
| cab drivers in the third world that are successful,
| because they live the life they want. I've met investment
| bankers in the first world that are failures, they are
| rich but can't do what they want because "N reasons",
| trapped as you put.
|
| A parent that cares for a disabled child is only a
| failure as long as he does not want to do it but has to.
| In this case he is not only a failure but a horrible
| person.
|
| I volunteer to care for old people 1h per month and I do
| not consider this a burden or entrapping or nothing like
| that. In fact I've met my first wife like this.
| arcanemachiner wrote:
| This sounds rather stoic. But people do not all have the
| same philosophy of life.
|
| Your definition of what constitutes a "failure" doesn't
| have to be the same as someone else, and that's OK.
| sadhorse wrote:
| I agree with that, and I am comfortable with the prospect
| of others not putting themselves first, therefore opening
| up the possibility of them putting my interests first.
| johnnyanmac wrote:
| >If you are not living the life you want then you are a
| failure.
|
| "For what it's worth... it's never too late, or in my
| case too early, to be whoever you want to be. There's no
| time limit. Start whenever you want.... I hope you live a
| life you're proud of, and if you're not, I hope you have
| the courage to start over again."
|
| My courage definitely wavers, but the stuff I'm
| "supposed" to do will hold me back if I try to what I
| want first. If I can't do that first, I'll at least set
| the breadcrumbs as I climb out of that pit.
| f1shy wrote:
| Wow... some think Java is portable... this is so nice!
| bigbillheck wrote:
| I took a quick look at cosmopolitan.h:
| https://justine.lol/cosmopolitan/cosmopolitan.h and counted
| 886 occurrences of "#if" (including #if and #ifdef)
| jart wrote:
| cosmopolitan.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 wrote:
| In 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 wrote:
| It doesn't count if all your platform code is abstracted
| away by libraries.
| cdchn wrote:
| Then you can appreciate how many #if macros it would save
| if you just targeted 1. ;)
| ramilefu wrote:
| Sounds like it wouldn't save them a single #if, if they
| are already at 0...
| marcus0x62 wrote:
| Meanwhile, over here in the Rust mines, I wrote a simple
| program that is little more than an http listener with a single
| route.
|
| Cargo pulled in something like 105 dependencies to build it.
|
| Although, as an apples to apples comparison, it does only have
| 2 use statements.
| lrvick wrote:
| This is a culture problem, not a language problem.
|
| Here is a http health check in 19 lines using only the rust
| standard library.
|
| https://dpaste.org/f895z
| marcus0x62 wrote:
| There's a lot of distance between "reinvent the wheel by
| implementing all your network functionality using nothing
| more than sockets" and "download 100 libraries to serve a
| file over http".
|
| There's a happy medium to be had.
|
| I'd also disagree this is not at all a language problem - I
| think it's both, in that the language has moved an awful
| lot of core functionality into the crate ecosystem, where
| there are a bewildering array of options for almost any
| need. The resulting explosion in the dependency graph is an
| entirely foreseeable consequence -- partially of that
| language design decision and partially due to the "npm
| culture" (for lack of a better description.)
| kqr wrote:
| Slighly off topic, but... how is npm culture different
| from CPAN culture? I have a feeling there is a difference
| but I'm too unfamiliar with both ecosystems to point it
| out.
| marcus0x62 wrote:
| Speaking as someone who used Perl pretty extensively back
| in its heyday I'd say the difference is CPAN modules were
| much more likely to be self-contained, or contain a
| handful of external dependencies, and those dependencies
| were almost always self-contained.
| rezonant wrote:
| Sure, if you are putting in a health check and nothing
| else, that's fine. When you need to parse headers,
| negotiate content types, validate maximum lengths on
| requests, properly log the source of the request (it's not
| just the connecting IP if there's a load balancer in front
| of it), parsing request bodies, dealing with range
| requests, authentication, cookies, providing a good
| middleware mechanism...
|
| The list goes on. While I'm not a Rust developer, there's
| probably hundreds of libraries because the problem is
| structured into a lot of small parts, and frameworks are
| expected to be able to satisfy the functionality you expect
| without needing to bypass it.
| lrvick wrote:
| As a security engineer it is still usually cheaper to
| write specific functions I need for highly limited scope
| applications than pull in libraries I have to review, and
| review every update to, forever.
| tubthumper8 wrote:
| In case you want to create a simple http listener without
| dependencies (besides the standard library), the official
| Rust Book has a tutorial for just that: https://doc.rust-
| lang.org/book/ch20-01-single-threaded.html
| marcus0x62 wrote:
| I'm aware, but thank you.
| rezonant wrote:
| This doesn't really surprise me, doing an HTTP service
| correctly is not actually trivial
| mianos wrote:
| And, the meme, for every comment in C or C++ on HN, there is
| one "but Rust".
| ccozan wrote:
| we should turn it into a law or somthing...
| marcus0x62 wrote:
| While we're making laws, we could add one where, if
| someone posts something even slightly critical of Rust,
| the first couple of responses will be from Rust
| apologists either: a) pointing out how wrong the
| criticism is, b) how the criticism is mis-directed and
| shouldn't be aimed at Rust, or c) how the criticism is
| really a beneficial and well-thought-out feature, but
| under absolutely no circumstances admitting that there
| might be anything wrong with Rust.
| fuzztester wrote:
| No true Rustacean?
|
| :)
|
| https://en.m.wikipedia.org/wiki/No_true_Scotsman
|
| Not sure if that's a good analogy, but put it out there,
| to see what people say.
| throwaway892238 wrote:
| OTOH, here is a hash table in C implemented entirely as macros.
| It's super cool: https://troydhanson.github.io/uthash/
| kelsey9876543 wrote:
| Justine, you are one of less than 5 programmers that make me
| feel envy. Hope to have a coffee or a whiskey with you some day
| if we ever cross paths. Enjoy your day, you are an inspiration
| and goals. Both mental goals and presentation goals, which is
| essentially unheard of.
| toasted-subs wrote:
| Looked through the Linux kernel and I was genuinely shocked.
| Something so simple, easy to read, and improve upon. Makes
| modern web frameworks seem like spaghetti code. Art vs scrap.
| 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.
| soulofmischief wrote:
| > Last Update: 2013-02-19
|
| Am I missing something? Where did you get 23 years from?
| a1o wrote:
| They are living four decades from now in 2040.
| Diederich wrote:
| What is the actual downside to hosting it personally
| _and_ hosting it on github or something like it?
| LastTrain wrote:
| Well I was called "brainwashed" for suggesting it without
| any explanation so good luck getting a coherent answer
| ;-)
| legends2k wrote:
| Downside is GitHub or any of the commercial git-hosting
| sites might use your code in ways you didn't intend e.g.
| machine learning, training neural nets, etc.
| Alternatively they might go out of business and go down
| after hinting you to save a local copy. These are
| countered by self-hosting your repo in your own
| (home/cloud) server.
|
| Downside of self-hosting is time, money and effort.
| You've to spend for energy and hardware and your time and
| effort to keep them shipshape. Chances of it surviving
| beyond you are slim.
|
| Both has downsides; just pick one depending on what kind
| of person you're. If you only want to write code vs that
| and also know how to maintain it. The latter is necessary
| skill if you ask me, instead of being just a code monkey.
| soulofmischief wrote:
| So we'll trust Namecheap for a couple decades but not a
| Microsoft-backed purpose-built website?
| quickthrower2 wrote:
| You believe that Github is some kind of heritage
| organisation? Incentives are aligned now, kind of, except
| they train an AI that they sell to other people on your
| code. I use Github but do it with open eyes.
| sesm wrote:
| GitHub has Arctic Code Vault program.
| quickthrower2 wrote:
| Just looked it up. That is impressive. Probably could do
| with some Antarctic geo redundancy ;-).
| flykespice wrote:
| There is also the lesser known repo.or.cz
| megous wrote:
| It's older than github, I think. I hosted one of my
| projects there in 2006 or so.
| 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.
| fallat wrote:
| That's not the problem. The problem is saying "the proper
| way to share code is with GitHub". There is no single
| proper way to share code, least using a commercial
| platform(s).
| dboreham wrote:
| People can poke around in it more easily. E.g. I wanted
| to look at the 6808 OS code but it's a zip file and I'm
| using a phone, so...
|
| Not saying it needed to be on github only, but unzipping
| into a set of repos there in addition to posting the zips
| would be helpful.
|
| I suppose anyone could do that, but then the provenance
| is not preserved.
| rijoja wrote:
| Personally I've become sceptical towards github since
| Microsoft took over it, and it's surprising to me that
| the open source community is so happy to use it in light
| of Microsoft's history of trying to fight open source.
|
| Of course there would be a lot of reasons to use github,
| which I'll refrain from attempting to list since I'm not
| really an expert of that particular subject, but those
| benefits has to be weighed against handing over the
| control of such vast amounts of data to a huge
| corporation which I'd think its safe to say, primarily
| would be interested in profit and survival, rather than
| the wellbeing of the open source community. One might for
| instance consider the possibly of the data being used to
| train an AI, which in itself isn't necessary a bad thing,
| but that still raises some questions. Apart from that
| relying on github's, might lead to vendor lock in, and it
| might also mean that the processes that gets used to
| develop projects falls under control of a in a best case
| scenario selfish actor and in a worst case scenario a
| hostile one.
|
| Perhaps you are familiar with the "embrace, extend and
| extinguish" strategy that Microsoft has been accused of
| employing? Things like these doesn't really inspire trust
| in the company's intention towards free software. Due to
| the size of the company, they are also capable of
| influencing the industry at large through various means,
| for instance via expensive advertisement campaigns, and
| to selling their solution to existing clients. So for
| instance they could create software such as VS Code and
| Teams, which would argubly be more or less copies of
| existing software, using their sizable pool of developers
| and then use it's huge marketing machinery to take over
| the market.
|
| Even tough the open source community seems to be
| flourishing at the moment, there would be threats looming
| on the horizon. For instance the question of how to
| relate to service providers who can profit off of open
| source code, without really having to share back since
| the code is running solely on their own servers, another
| one being that open source code gets used to build closed
| solutions with the help of AI.
|
| Personally I appreciate projects, that distribute code in
| the old-fashioned ways, which has proven to be successful
| in countless cases, and I would like to ask open source
| creators to consider the alternatives, and how they would
| fit in with the goals of the project. A lot of times I
| bet github still would be a good fit, but at the same
| time I'm sure that there are good ideas that could be
| implemented outside of those parameters.
| salawat wrote:
| You mean besides Microsoft R&D slurping all Github code
| up by default into an LLM training set by default? Not
| much.
| 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.
| megous wrote:
| Because it gives power to Microsoft to impose its will on
| millions of developers, and for little reason in this case,
| when the goal is just publishing software, and not
| development.
|
| Its UI for presenting large number of software projects
| sucks, too.
| 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?
| elvis70 wrote:
| I'm not Dave, but here's a thread on Vogons in which he
| announced his project, you could possibly contact him from
| there: https://www.vogons.org/viewtopic.php?f=7&t=97034
| 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?
| micromacrofoot wrote:
| depending on how organized you are... this can take a lot of
| time
| chatmasta wrote:
| I can definitely relate to this feeling of "when $this is
| all over, I'll open source a bunch of it, but it's too much
| work to factor it out now," where $this is more often a
| company or project than a career. Sadly, it almost never
| happens. It just goes to show the importance of open
| sourcing what you can, as you can (in other words, "now or
| never"). But it's a lot more work to do that than people
| imagine, even when they say "well just release it in the
| least polished form possible." You've still gotta deal with
| adding a new boundary to your codebase, which not only
| requires additional effort but also increases complexity of
| the wider project and makes it impossible to refactor
| without first refactoring a cascade of miniprojects you've
| created within it.
| josephg wrote:
| I often think of source code like moulding clay. While
| you're actively working in a codebase, the clay is moist
| and malleable. Making changes is easy, because the
| context of what it does, and how it's organised is fresh
| in your mind.
|
| But if you move on to another project and let time pass,
| the clay dries out and becomes brittle. When you open the
| project up again, it takes time to "wet the clay" - and
| remember all that context that you've forgotten. It's
| easy to add bugs, or reimplement methods that already
| exist somewhere else under a different name. But over
| time, you work water into the clay and it becomes
| malleable again.
|
| I agree with your comment. Refactoring software to split
| out libraries that you can opensource is a lot of work.
| More work than people realise. But if you think
| refactoring is a lot of work when the clay is wet, it'll
| be many times harder if you let the clay dry first.
| Refactoring as you work is always the best way, because
| it's often the only way to get it done.
| coldcode wrote:
| I wish I had saved something from my 40 years of programming,
| but I alwayds left everything behind when I moved to a new job.
| I did manage to keep my commercial memory allocator from the
| late 90's (single threaded, only supported Metrowerks
| CodeWarrior and the old MacOS), it was the fastest allocator on
| the Mac, and bug-free, but became obsolete with MacOS X. Not
| sure anyone would care today. I lost my source code to Trapeze
| as I mentioned yesterday (
| https://en.wikipedia.org/wiki/Trapeze_(spreadsheet_program) ).
| I guess I never throught about saving most of my work for a day
| when no one cared if I shared it.
| 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
| josephg wrote:
| Reading this thread makes me think about archiving my
| code too. I have backups of my project folders going back
| to the 90s when I started programming. But I often delete
| node_modules and other build artifacts before archiving
| because that stuff takes up so much space.
|
| But maybe it's worth going through and actively and
| explicitly downloading all those dependencies too. Who
| knows when npm will get hacked again, or old package
| versions will get yanked. Disk space is cheap. I've
| written a lot of code over the years. It would be nice to
| know it all still runs.
| 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.
| kqr wrote:
| Or stated a tautology. The trendy is almost by definition
| ephemeral and fragile. Otherwise we'd call it timeless!
| dotancohen wrote:
| > Very little of today's projects would survive one decade
| left fallow, let alone four.
|
| I hate to break it to you. 2040 is less than half as distant
| as you think it is.
| soulofmischief wrote:
| I want off this ride.
| soulofmischief wrote:
| Checking dependencies into VCS should be more common as with
| yarn PnP and such.
| BobaFloutist wrote:
| I think that's somewhat the curse of technology. It's so hard
| to make anything from scratch. How do you get metallurgy
| working without already having metals? How do you get
| electricity running without an outlet, or at least powerful,
| easily sourced magnets?
|
| Thinking about the "dependency tree" for any modern
| convenience is truly staggering. I can't even start to think
| about how you can make a factory without first having a
| factory.
| 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.
| josephg wrote:
| Node predates npm. All node does is look for dependencies
| in the nearest node_modules directory. (And all npm does
| is download dependencies into that folder). So you can
| simply archive / check in your node_modules directory if
| you want to. I think there's tools to help out and make
| sure the dependency versions are all pinned. (npm shrink-
| wrap and friends)
| touisteur wrote:
| Even before... Trying to compile archived versions of the
| python 2.7 runtime on recent Linux distributions is an
| exercise in frustration. Thank god for the gentle souls
| that keep putting out lightly updated compilable 2.7 python
| runtimes, your efforts haven't gone unnoticed.
| 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.
| 38 wrote:
| it being on GitHub does not keep it in peoples memory. so
| this argument is not sound.
|
| if it was on GitHub, and it made it to the HN front page,
| "tomorrow everyone forgets about it" would still apply.
| 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.
| genter wrote:
| I like to have several sequential ones. Easier to see on
| the oscilloscope. (I spent last night getting a
| microcontroller to talk to a SPI device, so I'm still
| licking my wounds.)
| theblazehen wrote:
| 0xAA 0x55 is actually used as the last two bytes in the
| MBR just for this purpose
| ahoka wrote:
| Endianness is byte order.
| UweSchmidt wrote:
| How would a HNer who's not familiar in those nether regions
| of computing, but wants to feel the excitement of sending a
| bitstream over a (possibly faulty!) serial data line, get
| started? Two Arduinos and a cable maybe?
| jareklupinski wrote:
| yup that's what I was building :)
|
| i was sending pixel data out from an Arduino (ESP32 really
| but using Arduino IDE) to a bunch of shift registers that
| seemed to be 74x595 (but couldnt know for sure) to
| resurrect an LED display for a local art project, and
| reading the data coming back out from the last register let
| me know I was at least getting back what I was putting in,
| which helped me troubleshoot a few wire length and
| speed/stability issues
|
| to get started with electronics and hardware in general, I
| wrote a short tutorial:
| https://news.ycombinator.com/item?id=35116705
| UweSchmidt wrote:
| That tutorial of yours is a lot more than I expected to
| get out of my question, such a cool first project!
| Thanks!
| robocat wrote:
| Personally I would recommend finding fun or useful projects
| where you have an outcome you really desire. Start simple -
| one sensor like a bath overflow warner (arduino is good or
| maybe raspberry pi).
|
| Learning hardware just for the sake of it is tough to keep
| motivated and perhaps you would never use the skills you
| learn? Hardware adds a tougher level to debugging - but
| software experience gives you a fantastic start - a logical
| mind and rational drilling down.
|
| If you can fix your car you have the skills to start on
| electronics!
|
| A lot of skilled people grew up through the hardware
| generations e.g. I began learning basic electronics because
| on an Apple ][ everything was simpler and we were all at
| the same stage. My first job was writing low level serial
| driver code and regularly dealing with serial devices (e.g.
| on PC). Our modern context is just not the same. The
| internet is hard to learn from. It is difficult to write
| good articles to help - the experienced like me just know a
| huge variety of implicitly learned knowledge.
|
| I suggest you concentrate on a useful or fun outcome - I
| believe it's good life practice (and good engineering) to
| stay focused on the outcome and not get too side-tracked by
| explicitly trying to learn. We implicitly learn just by
| doing!
| benj111 wrote:
| >If you can fix your car you have the skills to start on
| electronics!
|
| I'd like to think that this is a comment on the ease of
| fixing cars, rather than a comment about how fixing cars
| is basically embedded hardware/software dev....
| turndown wrote:
| The way that really clarified things for me was buying a 3d
| printer(an Ender 3 for me) and a Raspberry Pi. Setting it
| up and flashing a new OS to it should basically teach you
| the rudimentary workings of the hardware->software
| interface.
| Muromec wrote:
| Esp32 is the cool arduino.
| olalonde wrote:
| I would suggest to search for "Arduino starter kit" or
| "embedded starter kit" on Amazon. They come with lots of
| components and usually with some project guides.
| 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.
| fuzztester wrote:
| Panics and consequent crashes or reboots (?) used to happen
| in Unixen at times, maybe due to bitflips or other hardware
| errors.
| 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?).
| ChrisSD wrote:
| 1993
| 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
| indymike wrote:
| Bitflips aren't a new thing. I've been rarely but painfully
| bit by them since at least 1986. This. Excludes serial and
| modem communications where it was a way of life.
| dragonwriter wrote:
| > Random bitflips (aka hardware that doesn't work) are a
| relatively new thing.
|
| I thought they (from cosmic rays, etc.) were always a thing,
| but so rare that you needed a very large system (in scope or
| time or both) to have a substantial chance of encountering
| one (outside of noisy comm channels, which use error
| correction protocols for exactly that reason.)
| defrost wrote:
| Some event (unknown) triggered multiple spikes in the "tell
| me three times" redundant three ADIRU units of Qantas
| Flight 72 causing a WTF unscheduled sudden and dramatic
| pitch down
|
| https://en.wikipedia.org/wiki/Qantas_Flight_72#Conclusion
|
| Cosmic rays were suspected but unconfirmed (kind of hard to
| confirm after the fact).
|
| "All the aircaft in the world" for sixty years is kind of a
| large system given that currently there are on the order of
| one million people in the air at any moment.
| heisenbit wrote:
| There are lot's of thing that can go wrong beyond cosmic
| rays. Like timing on the bus or signals from close wires.
| Digital is an abstraction of an analog and chaotic reality.
| euroderf wrote:
| Cosmic rays ?
| justin66 wrote:
| > Random bitflips (aka hardware that doesn't work) are a
| relatively new thing.
|
| Bits flipping due to hardware that didn't work well was what
| caused Xerox PARC to implement an error correcting memory for
| MAXC, fifty years ago.
|
| https://gunkies.org/wiki/Maxc
|
| > Bit flips due to buggy software was a thing though.
|
| No kidding.
| 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.
| adrianmsmith wrote:
| The BBC micro and Archimedes used -1 as true in BASIC.
|
| It meant that you didn't need the distinction of "logical
| operators" (like && in C) and "bitwise operators" (like & in
| C). You could just use bitwise operators, e.g. the bitwise
| NOT operator would convert 0 (all bits clear) was -1 (all
| bits set) so there was no need for "logical operators".
|
| I always felt that was more elegant than C (but of course
| required a two's compliment machine, which BBC/Archimedes
| was, but C didn't require).
| layer8 wrote:
| This is only sound if you have a boolean type that
| guarantees that the bits are either all zero or all one.
| Once a mix of bit values is possible, you have to define
| whether it mean true or false, and then you can't use the
| bitwise operators anymore.
| 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
| AndreiBB wrote:
| Here is how I do it:
|
| #define FALSE 0
|
| #define TRUE (!FALSE)
|
| ASSERT( TRUE != FALSE );
|
| and let the compiler worry about which bits to use for TRUE
| russdill wrote:
| I've been on a team trying to argue that exact thing. If you
| aren't going to handle the case where the var is neither true
| nor false, at least by explicitly documenting the fail-safe
| case, you're just cargo culting. You get a lot of that type
| of thing in MISRA and automotive codebases.
|
| Any team that realizes that the compiler may choose to
| optimize out a shit-ton of such code gets an extra gold star.
| dahart wrote:
| Why do you think you need the "else: ??? What do I do here?"
| case?
|
| Until you added the 2nd test and the 2nd else case, there is
| no scenario under which both paths of an if/else would fail
| to execute due to a bit flip of the test variable, because
| with 'if (boolean_condition) {} else {}' there is only 1
| conditional test. A bit flip could have caused the wrong
| branch to execute, but it could not have skipped both
| branches. A bit flip could change the jump instruction to
| something else, but in that case your imagined else case
| still wouldn't help.
|
| > this is, at best, a very very partial solution
|
| FWIW, the author said this, and fairly succinctly, saying
| this TRUE=7 thing is "of course foolish as such a 1 bit
| hardware error would "trash" pretty much any system". He was
| only having a bit of fun that cost nothing, and nowhere
| suggested this is a solution to cosmic rays or other data
| errors.
| LastTrain wrote:
| No, and the author basically admitted it was silly. My counter
| would be that it makes the intent less clear. I loved reading
| through his style doc though and I love that he just threw all
| this stuff out there. Something in his collection is bound to
| scratch somebody's itch.
| kortilla wrote:
| It's a problem even now if you have software security checks
| dealing with adversarial actors with hardware access.
| rendaw wrote:
| This doesn't make any sense even if the system isn't trashed.
|
| If 7 == true and anything other than 7 == false, then one
| bitflip will still change the meaning. If 7 == true and 0 ==
| false, then you could have code that does `if (mybool == 7) {
| ... }` and later `if (mybool == 0) { ... }` and end up with a
| situation where code path invariants are broken (i.e. mybool is
| neither true nor false.
|
| If you use `>= 7` to mean true and `< 7` to mean false, while a
| 0 false value won't randomly become true if one of 3 bits
| randomly flips, a `7` true value will become false if any of
| those bits flip. And if any of the other bits flip, 0 will
| become > 7.
| fabbari wrote:
| In C any value != 0 is considered true. Nothing special about
| 7, he could have used any other number, but 7 is a single
| character, so he used that.
| kqr wrote:
| Even if it was, are you really going to think of every
| conditional as a tri-state boolean?
|
| Or will you assume that one of the branches is safe to execute
| during failure?
|
| Or will you count the number of bits in each conditional and
| assume more ones than zeroes is a true, with no error
| correction? Will you log that a bit has flipped or otherwise
| alert the operator? Will you consider that as evidence that an
| int has changed value too?
|
| Will you store ints with three bits per bits also?
|
| Error detecting codes have their place, but it takes more than
| just saying that true is 7.
| benj111 wrote:
| Slightly off topic, but why did 1 become the truthy value and
| not -1?
|
| Logical nots would then work.
|
| And youre still an inc/Dec away from the opposite.
| never_inline wrote:
| That depends on
|
| a) Two's complement representation
|
| and
|
| b) Wraparound on arithmetic, which is still UB in low-level
| languages.
| benj111 wrote:
| Ok. I used -1 as a short hand for 0b11111111(11111111(11111
| 11111111111(11111111111111111111111111111111))))
|
| Not doesn't rely on wrap around arithmetic.
|
| Wrap around arithmetic is only undefined for signed values.
|
| What platform doesn't wrap around signed integers?
|
| Just because c has some undefined behaviour, doesn't make
| it some natural law of the universe.
| 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.
| adastra22 wrote:
| Also ran into the same 404. There's not many original CAD
| programs out there. I'd love to see this one.
| kuroguro wrote:
| I think the MCSAMPLE zip contains the full thing as well
| 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.
| absoluteunit1 wrote:
| I'm curious, what do you mean by "Bibles" exactly ?
|
| And what are the organizing processes you learned; I'm always
| eager to learn productivity tips/software from others
| dotancohen wrote:
| I have quite a few of these bibles too. I'd love to swap some
| files if you're interested, I'm sure there is much to learn
| from yours. My Gmail username is the same as my HN username if
| you are interested.
| 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!
| legends2k wrote:
| This is a problem only we'd to face. Kids these days use Git in
| some hosting hub or the other that it's a rarity that their
| code gets lots. Of course if these "free" services go down...
| it matters. Self-hosting has its uses.
| valyagolev wrote:
| yeah when GitHub is sold to PE 15 years from now, and we get
| emails like "you have 2 days to backup all your repos", i
| hope I won't feel too lazy
| nestorD wrote:
| It is this exact realization, while looking for some of my
| old code, that first got me started using git and github.
| gpcz wrote:
| I have a lot of my old code, but I never want to look at it
| because it's super-cringe.
| magicalhippo wrote:
| I lost the first 5-6 years of code thanks to an IBM
| Deathstar[1] when I was 20.
|
| Got really depressed by it at the time, as it included most
| of the projects I worked on at the time. After that I got
| super paranoid about having backups.
|
| I do enjoy going back and looking at the code I still have
| though. Being self-taught it's mostly not terribly great, but
| I do have fond memories of finally cracking a certain nut or
| figuring out some neat trick.
|
| [1]: https://en.wikipedia.org/wiki/Deskstar
| varjag wrote:
| Mine did vary quite a bit within that period, from BASIC in
| middle school to some funky selective availability GPS
| handling prod code. But it's beside the point: I'd love it as
| memento, no expectation really that said game of snake would
| end up on Steam.
| 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 ?
| vitiral wrote:
| It's in COPY.txt, although it's homespun.
|
| If you're the author, please please release into the public
| domain (CC0) if your purpose is educational. That makes it so
| anyone can learn from it and build on it without any fear of
| infringement.
| 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?
| legends2k wrote:
| > 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?
|
| The author seems quite aware of this. He calls it out
| specifically: it's for learning and curiosity purposes.
| accrual wrote:
| Surely, but the author also says:
|
| > my goal now is to release 40+ years of source code
|
| And there was no code in the .zip. Shrug.
| cxr wrote:
| The seem to be three points of confusion here:
|
| Confusion on your part regarding what the other commenter's
| complaint is. The complaint is that the source code archive
| they downloaded did not contain the source code. It contained
| an old copy of a shareware notice instructing the reader to
| write to Dunfield for access to the source.
|
| Confusion on Dunfield's part: specifically, the belief that
| he had included the correct version of RINGSW.C when
| republishing this stuff to celebrate his retirement.
|
| Finally, confusion on the part of the other commenter here,
| involving an assumption that Dunfield's oversight was a
| deliberate decision.
| 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...
| potwinkle wrote:
| Very cool to see such a long history, were the different projects
| you worked on related to what was going on at your job at the
| time?
| yndoendo wrote:
| Any one catch the out of memory comment?
|
| # we require more vespene gas; unix consensus;
| kNtErrorOutofmemory;
| golem14 wrote:
| Worth reading the Author's recollections of his almost dying in
| 2019:
|
| https://dunfield.themindfactory.com/2019.htm
| haolez wrote:
| That was intense. It made me think about my father in law, who
| had a heart attack in 2015 that compromised 90% of his heart.
| His exams are so ugly that one of his physicians refused to
| threat him, probably worrying that he might die any minute
| during the appointment.
|
| He is still alive today, he has a normal life and he even
| manages to go for a run in the beach every saturday. His exams
| haven't improved, he is always out of breath, but he just
| refuses to die. It's like what the physician said in the link
| above: "You look a lot better than what's in the paper".
| hnthrowaway0315 wrote:
| Strangely reminds me of "The Shadow out of the time" by the
| reverent HPL.
| winrid wrote:
| > "Hug his children. Sleep in his own bed. Eat his meals. and
| Work a little with his hands." in her words "They shot
| everything she said down"
|
| Anyone know why doctors do this? They did the same thing with
| my father when he wasn't getting better (leukemia with
| pneumonia) and they couldn't get him off the breathing tube.
| They were very adamant he'd be disabled for life.
| kingds wrote:
| doctors are all completely insane and should never be
| trusted. the process of getting into and through medical
| school has a selection bias towards type-a sociopaths. and
| whoever makes it through that wringer and gets board
| certified has to be constantly on guard for malpractice
| lawsuits. half sarcastic but mostly i do believe this lol
| zulban wrote:
| It's tough. A vast majority of the time the doctors are right
| about recovery, and the family is wrong, and optimistic to a
| delusional degree. It's hard work telling family how bad
| things really are.
|
| Still, if something happens to me or loved ones I hope I get
| doctors who can distinguish between zero and one in a
| thousand.
| BobaFloutist wrote:
| I mean they're giving the best information they have.
| Sometimes it's wrong, but unless you think they should hedge
| more (which people also hate, "Why won't doctors ever commit
| to something, it's always 'maybe' or 'I don't know' or 'we'll
| see', what's the point of the degree and the high pay if they
| don't know anything?!") I don't really see what else they can
| do.
|
| We hear a lot about all the times they're wrong, because
| they're tragic or frustrating or confusing, and because
| biology is super non-deterministic they're probably wrong
| more often than say physicists, but they're also right a lot
| of the time too, enough of the time that we consider it worth
| having them. We just don't get as many articles and anecdotes
| about a doctor correctly predicting someone's disability,
| because it's not as interesting.
| m3kw9 wrote:
| Grim af but that looks like a happy ending
| kmoser wrote:
| Not ready to retire, but I did something like that a few years
| ago with the previous generation of code I wrote:
| https://www.kmoser.com/sourcecode/
| aquarin wrote:
| Some links unfortunately are broken.
| anArbitraryOne wrote:
| Great LLM training data
| keepamovin wrote:
| This is wonderful. Thank you. Very moving that you choose to
| share this!!! Thanks for making a positive impact on the world.
| sakesun wrote:
| Respect. I'll follow when my time come.
| tqwhite wrote:
| At 70, I do not think anyone has anything to learn from my 40+
| years of code. I envy Mr Mindfactory's confidence.
| paulryanrogers wrote:
| Thanks for your humility. Still, please consider sharing what
| you can -- even if only with customers of your software. We all
| have so much to learn.
|
| (I do regret giving too much of my time to free projects, yet
| have found a satisfying balance by including source with
| purchases of software I sell.)
| ofey404 wrote:
| Thank you! You show me a living history of computer programming.
| m3kw9 wrote:
| I like how he puts his email as a captcha
| https://dunfield.themindfactory.com/contact.htm
|
| And slyly tells you the "password" to get past his spam filter
| eliben wrote:
| This code is enjoyable to look at - it's clean, well-documented,
| and clearly a work of love. I like all the small utilities that
| help the author accomplish a bunch of goals.
|
| I wonder if the code manages be so clean because it's only aimed
| at a single compiler and a single platform. Multi-platform C code
| tends to be messy with preprocessor goo.
| snvzz wrote:
| Not using a standard license but rather a bespoke one is a major
| legal roadblock.
|
| The presence of use restrictions does also disqualify it from
| being Open Source (OSI trademark) or Free Software (GNU/FSF).
|
| If a standard license was adopted instead, such as MIT
| (permissive and I believe well-aligned with the intent of the
| author), then any concern would go away.
| dingdong33 wrote:
| Why didn't he use more memory safe rust?
| strangattractor wrote:
| Hate to say it but I remember when this stuff first came out.
| Thank you for releasing the code. Brings back memories.
| alisoncopeland0 wrote:
| I wish I remembered how...my car accident made me dumb ...
| alisoncopeland0 wrote:
| I wish I remembered code my car accident made me dumb...lol
___________________________________________________________________
(page generated 2023-11-04 23:01 UTC)