80 comments
I was just thinking... do they really need a 32-bit int for that?? A bool or char would do it. Yes, it's classic optimize-for-speed-not-size. ;) It's only a couple extra cycles to do the bitwise AND to unpack a packed bool array, but there are times where that would really count. @nixCraft jokes aside that is indeed @GolfNovemberUniform @nixCraft donΒ΄t get it. wouldnΒ΄t a boolean be sufficient for this case? @RDogPinK @GolfNovemberUniform @nixCraft Not only sufficient, but perfect. int32 is most definitely not. @RDogPinK @GolfNovemberUniform @nixCraft In type theory you could say that it's value is true or "bottom" if it is executed symbolically rather than physically. @RDogPinK @GolfNovemberUniform @nixCraft I mean depending on if youβre writing old C. They didnβt have bools, just Ints. Bools were specified by the stdbool.h IIRC much later in time @EndlessMason @GolfNovemberUniform @nixCraft yeah, but the function says "computer_on", not retrieve status ;) @RDogPinK @EndlessMason @RDogPinK @nixCraft A hybernated computer is not an operational computer. And what does thermal throttling have to do with it? @GolfNovemberUniform If I have those same 4 cores but they're running at 50% of their usual clock speed to prevent over heating the computer is also half on. @GolfNovemberUniform Like one might expect from a water tap, or a dimmer lamp except with computers you know... The kind of thing one might represent in a int32? @RDogPinK @GolfNovemberUniform @nixCraft Consistency with other BeOS API's was probably more important than considering it strictly in isolation. It was a syscall, so using the standard "return an int" idiom probably made the most sense in context. @GromBeestje @nixCraft It's critically important to run this in a separate process to HCF()! @GromBeestje @nixCraft This should also cover the temperature inside a supernova, so we are safe on that side ;) @GromBeestje @nixCraft wish Iβd had access to this before I had to read a whole book to find out https://mitpress.mit.edu/9780262539739/your-computer-is-on-fire/ @GromBeestje @nixCraft I'm old enough to remember when computers were room sized and parts of it could be on fire while others continued to work relatively fine. There used to be an option to stop disks fast in the event that they were on fire. @ianturton @GromBeestje @nixCraft @GromBeestje @nixCraft how do you distinguish "some other value" from the temperature? should be re-written in Rust and return a `Result` element @JackEric @GromBeestje @nixCraft Yeah that's what I was thinking. Maybe negative 10 Kelvin, below absolute zero? If C++, should return a boolean with temperature as a pass by reference parameter. Okay, I just googled it and it's real. I don't know whether to be delighted or horrified. Also (and sorry for the monologuing), I once witnessed a demo of the original dual-processor BeBox where the presenter showed how to turn off one or the other of the cores from the settings interface. He then turned off both of the cores, and it did exactly what you'd expect. While the computer rebooted, he segued on to how robust the filesystem was. So, on reflection, this seems pretty on-brand for them. @nixCraft @DenOfEarth @nixCraft probably going to need some @nixCraft Absolute pig of a function to implement on a virtual machine that can be migrated @Victorsigmoid @kami_kadse @nixCraft Was it the PDP-11 that had "?PWF" for a power failure - my forgettery seems to think so, but it was long ago... 3:O)> (And the ASR-33 keyboard was _TERRIBLE_.) @Cadbury_Moose @kami_kadse @nixCraft Or possibly an LLM responder to make it relevant and marketable? Put some AI in it. @nixCraft Too much bloat. Why use a 32 bit integer? That takes up way too much RAM. It's a perfectly decent function... just a *partial* function, i.e., not defined on all its inputs. Perfectly decent thing to be. @nixCraft was the image description made by OCR? the function name reads "18_computer_on" instead of "is_computer_on"
goddamnit undefined behavior has gone too far @nixCraft It's not much use without the companion functions well_turn_it_on_then() and sheesh_why_do_I_have_to_think_of_everything_myself_around_here() @nixCraft SchrΓΆdinger's computer: it might be on, it might be off, you'll never know until you call this function @nixCraft I'm reminded of the vital opcodes for power saving in CPUs @nixCraft This is from the BeOS manual. As I recall, there is also an @nixCraft // returns true if executed on a computer PS.: <pre> tag when, Mastodon? @nixCraft It was a joke API, but that was secondary to it being a do-nothing syscall, useful for measuring system call overhead. |
@nixCraft
my Ryzen 7750X:
is_computer_on(); // 1
a cache corrupting i7 14700k:
is_computer_on(); // 153