News for hackers. Stuff that matters.

creativemonkeys

Re:Meta Quest Pro on Tuesday October 11, 2022 @03:31PM (#33168106)
In Lex Fridman's podcast, Carmack says he's officially only working 1 day at Meta in advisory capacity, though sometimes chimes in on other days as well. He also says he wants to completely focus on AGI, so I wouldn't rely on Carmack to push the VR field forward in the near future.
Re:Meta Quest Pro on Tuesday October 11, 2022 @03:25PM (#33168029)
Because Meta bought Oculus. It's not the news feed guys designing the next gen VR hardware.
Re:What does the ??!??! operator do in C? on Thursday October 06, 2022 @10:00PM (#33116604)
Have any of you downvoters read the C grammar? There is no --> operator in C. I'll never understand some people.
Re:What does the ??!??! operator do in C? on Wednesday October 05, 2022 @07:30PM (#33102531)
"-->" is not an operator in the C language, it's just a way of writing the unary operator "--" and comparison operator ">" together without any whitespace between them, since whitespace is ignored by the lexer.
Re:The road to Zettalinux on Friday September 23, 2022 @08:15PM (#32958602)
I suppose short and long have to do with register sizes being available as half word and dword, and there are instructions that work with smaller data sizes on both x86 and ARM, but I agree that in today's world, you want to know the number of bits. On those weak 4MHz machines, squeezing a few extra cycles was typically very important.
Re:The road to Zettalinux on Friday September 23, 2022 @10:04AM (#32952084)
I'm sure someone will come along and explain why I have no idea what I'm talking about, but so far my understanding is those names exist because of the difference in CPU word size. Typically "int" represents the natural word size for that CPU, which matches the register size as well, so 'int plus int' is as fast as addition can run by default, on a variety of CPUs. That's one reason chars and shorts are promoted to ints automatically in C.

Let's say you want to work with numbers and you want your program to run as fast as possible. If you specify the number of bits you want, like i32, then the compiler must make sure on 64bit CPUs, where the register holding this value has an extra 32bits available, that the extra bits are not garbage and cannot influence a subsequent operation (like signed right shift), so the compiler might be forced to insert an instruction to clear the upper 32bits, and you end up with 2 instructions for a single operation, meaning that your code now runs slower on that machine.

However, had you used 'int' in your code, the compiler would have chosen to represent those values with a 64bit data type on 64bit machines, and 32bit data type on 32bit machines, and your code would run optimally, regardless of the CPU. This of course means it's up to you to make sure that whatever values your program handles fit in 32bit data types, and sometimes that's difficult to guarantee.

If you decide to have your cake and eat it too by saying "fine, I'll just select i32 or i64 at compile time with a condition" and you add some alias, like "word" -> either i32 or i64, "half word" -> either i16 or i32, etc depending on the target CPU, then congrats, you've just reinvented 'int', 'short', 'long', et.al.

Personally, I'm finding it useful to use fixed integer sizes (e.g. int32_t) when writing and reading binary files, to be able to know how many bytes of data to read when loading the file, but once those values are read, I cast them to (int) so that the rest of the program can use the values optimally regardless of the CPU the program is running on.

Re:Ask HN: What interesting problems are you working on? on Friday September 16, 2022 @09:38PM (#32874040)
I've built a C compiler and have read the dragon book. I wish I read Crafting Interpreters before reading Compilers by Aho. It's good, and there's no nonsense. The author knows what he's talking about. Plus it's free to read online. 10/10 would recommend.
Re:Adobe to acquire Figma for $20B on Thursday September 15, 2022 @02:52PM (#32856780)
Photopea has been pretty good at replacing Photoshop for my needs (non-designer).
Re:Ask HN: Have tech salaries been stagnant for the past decade? on Thursday September 15, 2022 @10:40AM (#32852757)
I'm moving to PA, so out of curiosity, why are you recommending to move to Philly?
Re:The impact of removing jQuery on our web performance on Tuesday August 16, 2022 @01:20PM (#32485897)
I think you misunderstood the comment you replied to. Their point wasn't that 12s to 9s is a negligible improvement generally. The point was that the improvement only applied to a tiny fraction of their users and it was still a bad experience, precisely because it was so far from 1s.
Last time I checked how much I'd lose, it was between 10k and 15k, which is not much compared to my total comp.
Re:How did Tropicana lose $30M in a packaging redesign? on Tuesday May 17, 2022 @07:09AM (#31408704)
Yeah... that's a pretty deceptive practice, though I assume it's legal to buy a brand and manufacture a different product under that label.
I think it tastes different now too, but I can't find an old bottle to compare.
Re:Cron-based backup for SQLite on Sunday May 15, 2022 @08:25AM (#31387142)
If I'm using "-e", I also like to use "set -o pipefail" which will fail the script if any command in a pipeline fails too: x | y | z, which is useful if 'y' fails but 'z' continues to process the output and returns 0, -e won't catch that (the example script doesn't use pipes though).
In my experience, the American society places a high value on 'balance' - from "checks and balances" to balanced individuals, to balanced meals, to balancing criticism with some praise first, etc. When this balance is off, most people's innate reaction is to reject the imbalanced person, and by extension, their ideas, regardless of any objective measure of the value of those ideas.

Being direct creates an imbalance, for example when one describes an issue or person purely from a negative point of view, regardless of whether all of it is actually true. Most people will innately attempt to say something positive about that same person to restore some sort of balance to the discussion.

Generalizations are also an example of imbalance, with people typically having a strong reaction to it, even though I think most people would agree that if 97 times out of 100 something is true, it's safe to say that thing is true.

Lastly, as a special case of generalizations, taking an absolute stance is also seen as imbalanced, and therefore bad, because, I assume, most things in life aren't black and white - there's lots of gray areas, so it's pragmatic to start out assuming that in actuality there's a gray area with any issue.

This is all to say that Stallman doesn't speak in a balanced way, which is why I think his speeches and ideas do not appeal to the American audience, or any other audience that places a higher value on balance than on the actual ideas.

If he were able to convey those same ideas in a less absolutist, more nuanced and more pragmatic manner, I think he, as a person, would be more appreciated in the US and perhaps people would listen more closely to what Stallman has to say.

I've lived in several other countries, particularly in Europe, and generalizations, absolute positions and speaking in a direct manner are all generally appreciated by the society there, or at the very least it's tolerated much better and won't get you dismissed right away (since that's how most people speak).

At the end of the day, I personally think Stallman is right. When I look at what he says, I see a non-compromising idealist who places more value on truth, and how things "ought to be", than on pleasantries and gray areas, and that's a difficult sell to the American audience. When I focus on his content with the understanding that he's converting gray into either black or white, I see a dreamer and a believer in a utopian society. I too would like to live in a world where all software is FOSS and we all write FOSS code that runs on FOSS hardware, but I recognize that's a dream. It shouldn't stop us from trying to make that dream a reality though.

Re:Old C code – how to upgrade it? on Friday April 08, 2022 @02:33PM (#30960818)
on small projects, with clang, I use "-Weverything -Werror" and then I start fixing the issues one by one. I also either disable anything I'm willing to live with using -Wno<warning> or I use '#pragma clang diagnostic ignored "-W<warning>"' if it's only relevant for specific portions of the code.
Re:TypeScript as fast as Rust: TypeScript++ on Thursday April 07, 2022 @09:54PM (#30952483)
As far as I can tell, D already implements this idea. The Rust/RustGC duality is very similar to D's approach, which has manual memory management and an optional GC [1], and DMDScript [2] could be the scripting language.

[1] https://dlang.org/spec/garbage.html

[2] https://github.com/DigitalMars/DMDScript

Re:The case for a modern language on Sunday January 23, 2022 @03:35PM (#30050179)
To answer your question, I'm well aware of the backends used, but using LLVM doesn't mean that the same IR or assembler gets generated. Enjoy the rest of this weekend.
Re:The case for a modern language on Sunday January 23, 2022 @04:34AM (#30044856)
That's not a bad argument, it's a statement of fact. I'm using it to point out that using Rust carries risk, whether you realize it or not. Just because you've accepted the risk, doesn't mean it is a universally good decision and C is now bad. Maybe coming down from a tree pays off, maybe you get eaten by a jaguar.

People who don't put in the effort to really learn their tools, need tools with training wheels. It's perfectly fine for a language to put in checks to protect you against yourself and be "fast enough for practical purposes", just don't confuse "almost fast" with "always fast". Rust programs have to pay the price for runtime checks because Rust doesn't trust you to know what you're doing.

Re:The case for a modern language on Sunday January 23, 2022 @12:38AM (#30043900)
I don't see a problem with using C in the real world, but if you're going to attempt to race on the highway and you don't know how to steer clear of potholes, don't go blaming the car when the wheels fly off. The car requires you to know how to drive at high speeds and a lot of people don't know how to, so instead of being honest with themselves, they look around and conclude that it must be the car's fault, because this many people couldn't possibly be that bad at racing.

It's possible to become a better driver to handle the F1 car, just like it's possible to arrive at the same destination driving a Corolla, just 2 minutes later. If you want the speed though, you have to put in the effort.

Re:The case for a modern language on Saturday January 22, 2022 @11:10PM (#30043562)
They came, they saw, and they went away, and C is still the smallest, fastest and most portable language.

I think the only way to dethrone C is to change the equation of what's expensive to do in hardware - accessing memory, and that's not a problem us software guys are going to solve.

Re:The case for a modern language on Saturday January 22, 2022 @04:46PM (#30041134)
What you're missing is the difference between known issues and unknown issues. You're looking at a language that's been heavily used for 60 years and accumulated a long list of known issues and things not to do, that powers pretty much everything in computers, and you're comparing that with the new kid on the block with a vocal fanbase.

You could invest your time into learning that finite list, or you could invest your time into learning a new language with a long list of _unknown_ issues yet to be discovered - but out of sight, out of mind, right?

As far as runtime speed goes, assuming equal instructions being generated, if Rust spends even one CPU cycle checking array lengths, its generated code will be slower than C's, by definition. You can justify the trade-off ("it checks array lengths for me because I am human and I forget sometimes") or relax the restrictions ("it's not humanly noticeable"), but you can't claim it runs faster or even just as fast, because it's not.

The only thing Rust proved to me is that there was a whole generation of developers who did't mind writing unreadable Perl code who had kids that are equally unaware of how unreadable Rust code is and it'll take a few decades for them to see that, assuming that Rust stays relevant for another decade.

Re:The case for a modern language on Saturday January 22, 2022 @10:15AM (#30037373)
A segfault lets the user know that the developer made a mistake, and where in the code it happened. Blaming C for segfaults is blaming the tool.

C is a small language with a spec designed to adapt to new hardware while remaining fast. The spec is ambiguous in precisely the places where resolving the ambiguity would mean either limiting its portability or its speed. This increases the learning curve significantly and also requires diligence on behalf of the developer, so it's high effort to write.

It's a perfectionist's language, because, if you can steer clear of the known pitfalls, you get a working piece of software that's maximally portable and fast, and fast is still what we want our tools to be.

There is a place for Zig, and Nim and Rust in this world, but there is no world in which these tools make the same trade-offs as C and end up with a faster and more portable (across hardware) language.

They can sacrifice speed to make it more difficult for the developer to make mistakes. They can sacrifice portability to make assumptions that resolve undefined behavior, which would also decrease the burden on the developer, but they will never get all three - correctness, portability and speed, so in that sense, they will never replace C, they can only hope to starve C of developers.

Re:The case for a modern language on Saturday January 22, 2022 @09:40AM (#30036999)
Absolutely not. Once a user reads "Head First Java" or customizes Django sites, they get their standard issue keyboard and they're ready to start writing interrupt handlers in C. If the code crashes, it must be the language.
Re:The case for a modern language on Saturday January 22, 2022 @06:00AM (#30035604)
One of C's design principles is to be fast at the cost of safety, just like an F1 formula car. It will let you make fast mistakes.

You drove a Corolla in college, then got a job and drove a cool BMW for several years and now you think you're hot shit, so you hope in an F1 car and not only does it take forever to learn how to drive it, it has to be driven on a special track and the gearbox is different, what a nuisance!

"If only we could add 4 doors, automatic transmission, snow tires, and a trunk to put our stuff in, people won't keep getting into accidents with this car", you say. Right, but then it becomes a BMW. If you want real speed, you need to first go slow and master the car because otherwise you'll crash and burn.

C is messy because real world hardware is very messy. You can't push bytes through the hardware at its speed limit without getting your hands dirty, and we all come out into the real world wearing "class Dog extends Animal" white gloves.

To use C effectively, you should not be coding in C in your mind. You should be thinking in assembly, but your fingers should be typing C code. It's not safe, but if you want to reach 230MPH and accelerate at 60MPH in 2.6 seconds, you better know exactly what you're doing when you hop behind the wheel of that car. It's not for the weak.

Since 2013, I've spent $1287.38 on bundles in Humble Bundle. This change doesn't seem to affect people like me, how primarily buy bundles, but my guard is up now.
Re:How to easily read 50 books a year on Wednesday January 12, 2022 @08:47AM (#29906206)
I can whole-heartedly recommend "The Ray Tracer Challenge" by Jamis Buck. It's a fun project-based book without all the computer graphics theory, where you focus on building a ray tracer in small increments while Jamis holds your hand until you can walk on your own. As a small bonus, you get to generate some awesome images pretty quickly.
Re:After recent update I see License Upgrade Required (2021) on Thursday January 06, 2022 @12:01AM (#29819633)
I'm not a SublimeText user (so I have no skin in this game), but from reading the discussion, it seems to me like the problem is as follows:

  1. You bought a license to use SublimeText 3 in perpetuity
  2. Later ST3 offers a routine update that doesn't communicate the fact that it is actually an upgrade to a product with a different licensing scheme. This comes as an unpleasant surprise to you.
  2a. Additionally, applying a small update constitutes a small interruption to whatever you were doing (update, restart, continue editing).
  3. Once started, ST4's very clear messaging is that you need a new license.
  4. Because of #3, the minor interruption turned into a large interruption. Yes, people can go and downgrade, but _they shouldn't need to do that_. 
In my opinion, it's not OK for this to be the default behavior of an app, just like it's not OK for you to buy an economy seat on a flight, get reassigned automatically to business class and then be asked to pay a higher price for the same flight because you're now flying in business class.

I think #2 was a mistake on ST team's part (which they acknowledge) and it makes them look unprofessional in this one instance.

It is a frustrating experience, and it's OK and normal for users of SublimeText to feel frustrated. I want to make sure this is recognized, because saying "oh oops it was a bug" explains the root cause, but doesn't acknowledge the frustration it causes. I see this in software all the time. Software is for humans - we, as software developers, need to own the human consequences of these bugs as well, not just the technical side-effects.

Re:Ask HN:Why is Perl so dwarfed in data science by Python? on Wednesday January 05, 2022 @11:06AM (#29810684)
I'm a software developer who worked with research assistants and scientists for 10 years on large scale multinational projects at an Ivy League university. It's getting better these days, but at the time, those folks didn't have the time to learn proper software development - they had a ton of pressure to deliver results and publish papers.

Here's a bunch of things I was dealing with on a daily basis at the time:

  * No revision control - sometimes files got deleted and research was lost
  * Code that worked by accident, e.g. accessing the first element in an array using @array[$0] instead of @array[0], which worked only because $0 evaluates to "myscript.pl", and @array["myscript.pl"] returns the first element in the array.
  * Some people just liked their code left-indented (read: no indentation at all anywhere)
Most of the code was Perl and Matlab. Perl was hard to read, but it was good for text processing, not so much numerical processing, and Matlab was good for numerical processing, but it was slow and bloated.

When Python came along, with batteries included and with science-friendly libraries like numpy and scikit (so not just text processing, but proper numerical processing) you could get away with coding all your stuff in Python (though a lot of stuff is still Matlab). And on top of that it was easier to learn and to read than Python and it was fast enough. It was a no-brainer, so newcomers stopped learning Perl.

That said, Python's biggest contribution to this world, in my opinion, was forcing people to indent their goddamn code, because, as super-smart as these science guys generally were, they were also super-stubborn.

As for me, I moved from academia into the industry and it's so much nicer to work with other software developers. Sometimes I wonder if I should stop making some billionaire richer and go back to contributing to the scientific field, but, unfortunately, I have bills to pay. Maybe when I retire.

Re:The UX on this small child is terrible on Tuesday January 04, 2022 @11:25PM (#29805112)
One thing we did early is train our first child that she should not expect us to be in the room when she sleeps. It took a few iterations of (put baby to sleep, leave room, give baby a chance to self-soothe, pop back in for a bit to let her know we're still here) until she no longer cried when we left the room.

We didn't set a timer, but we usually gave her 5-10 minutes to calm down before popping back in.

If there's one thing I've learned though is that every baby is actually different (and it's not just a saying). For example, we've been bottle-feeding the baby right before sleep (nap and evening) every day for two years now, which I understand is against the usual advice of not feeding the baby immediately before putting her to sleep, but we found that she sleeps much better throughout the night and it didn't seem to cause any issues as long as we burped her properly before laying her down in the crib. YMMV though.

Older »