HNHacker News
TopNewBestAskShowJobs

david2ndaccount

1,196 karma · joined February 28, 2020

blog: https://www.davidpriver.com
submissionscomments
david2ndaccount··on E3 Is Officially Dead
I found my interest in video games died when I started working. Whatever button in my brain video games were pushing is now being pushed by the day job and I get paid for it.
david2ndaccount··on Compiler Options Hardening Guide for C and C++
Indeed, -Werror doesn’t make sense, but specifying specific errors (like -Werror=return-type to prevent forgetting to return a value from a function) is very, very necessary.
david2ndaccount··on Why does unsafe multithreaded std:unordered_map crash more than std:map?
Tsan doesn’t understand mach semaphores unfortunately.
david2ndaccount··on If you plant milkweed, they will come
Make sure you plant native milkweed. The exotic kind is not good for the butterflies.
david2ndaccount··on Toyota Prius on LA Craigslist Has a Catalytic Converter Cage Like a Prison
I don’t know why you’d want to live in the LA area and not own a car. One of the things that is actually nice about southern california is the ease with which you can go to the beaches, the mountains and other beautiful places and realistically you need a car to do these things. You don’t have to drive at rush hour.
david2ndaccount··on The Ruff Formatter: A fast, Black-compatible Python formatter
If your team is full of adults, you just pick a formatter tool at the beginning of the project, add it to your pre-commit hook and then never think about it again.
david2ndaccount··on Advent of Code 2023's new AI/LLM Policy
Leaderboard will be dominated by AI-assisted speed runners this year. I think I’ll just solve them in the morning this year instead of trying to get on the leaderboard (I can usually get in the top 100 on the trickier ones). Will be better for my sleep anyway.
david2ndaccount··on Trying out C++20's modules with Clang and Make
I do not expect standardization of features that do not exist.
david2ndaccount··on Trying out C++20's modules with Clang and Make
This works for C, but not C++. And for C, it’s not that hard to do by hand so no one else bothers.
david2ndaccount··on Trying out C++20's modules with Clang and Make
The ISO committee should not be in the business of inventing language features out of whole cloth. That is not how “standardization” works. They should only standardize existing practice.
david2ndaccount··on Show HN: I built a virtual tabletop for playing Dungeons and Dragons
The dungeon itself is the game/puzzle/challenge that the players are trying to overcome, either for the default goal of finding its treasure or for a specific goal like find a specific macguffin or other target. In this mode, the players trade their resources to overcome challenges and if you can achieve your goal without fighting or expending resources at all, the more the players are able to achieve. The default is not to fight every monster you encounter but to decide if you need to engage to achieve your goal. Random encounters are a way for the dungeon to fight back against the players and to put a clock on them - the longer they take to explore the dungeon or the less efficient they are in their exploration, the more they will have to deal with encounters that are unlikely to have any treasure at all.

It’s a very complex and interesting game to play. Unfortunately newer editions have gutted this gameplay by removing xp for gold (thus removing the default goal of most dungeons) and removing all of the procedural dungeon crawling rules. The tabletop form is still superior to CRPGs as your ability to interact with the world itself and overcome challenges in interesting ways is only limited by your imagination and ability to creatively apply the tools available to your character.

david2ndaccount··on My personal C coding style as of late 2023
You only know there are no mutations if Foo itself does not contain any indirections. Additionally, the compiler generally cannot assume that Foo_bar does not modify Foo as it is legal to cast away const as long as it is not originally a variable declared as const (so in your static Foo example it would be UB to cast away const).

static + const is valuable, but const parameters are merely a convention, there is no actual enforcement around them and due to aliasing the compiler generally can’t assume the parameter doesn’t actually change anyway.

david2ndaccount··on My personal C coding style as of late 2023
Arguments to sizeof aren’t actually evaluated (except for variably-modified-types, AKA VLAs, but don’t use those).
david2ndaccount··on My personal C coding style as of late 2023
I disagree about the structs vs out-parameters thing. I’ve found it makes functions that could return an error much harder to compose and leads to a proliferation of types all over the place. In practice almost all functions can fail (assuming you are handling OOM), so having a predictable style of returning errors is more important.
david2ndaccount··on Ways to break your systems code using volatile (2010)
In a discussion like this you have to mention that Microsoft’s compiler extended volatile to mean atomic[1], although its default behavior depends on target ISA apparently. Regardless, just use c11/c++11 atomics at this point.

1. https://learn.microsoft.com/en-us/cpp/cpp/volatile-cpp?view=...

david2ndaccount··on ASCII protocol buffers as config files
We do this at my work, it works fine. Much better than JSON and skips the insanity of YAML. And it’s nice to have a commented definition file for what is expected/valid in the config.
david2ndaccount··on Costco now offering virtual medical care for $29
Perhaps the president/congress shouldn’t try to make unconstitutional compromises.
david2ndaccount··on Don't use Discord as your Q&A forum
If you don’t run a discord, one of your users will “helpfully” start one anyway and the community will go there. You’ve then lost control of your Q&A forum.
david2ndaccount··on Writing a Package Manager
Honestly pretty strange to write a package manager for sqlite and to use directories + json files to store the data instead of sqlite.
david2ndaccount··on Extend a C/C++ Project with Zig (2021)
I personally would rather not use a pre 1.0 release of an entirely different programming language to compile my C/C++ projects.
david2ndaccount··on Flatpak is not the future (2021)
This works for MacOS because there are system frameworks you can rely on being installed (like AppKit) and that actually have backwards-compatibility (at least for a while). Linux distros don’t have this (not even for glibc), so you’d have to literally everything in your app image folder. Every GUI app bundling QT or other gui framework would be a ridiculous waste of space.
david2ndaccount··on Getting a job at Apple without going to college or doing LeetCode
I write a lot of C and gave up on reading K&R as it is just too outdated.
david2ndaccount··on America’s top environmental groups have lost the plot on climate change
The endangered desert tortoise needs land. Paving it over for solar panels is not the solution. Just because city-dwellers see these areas as “empty” doesn’t mean they don’t have sensitive ecosystems that are already becoming rarer and rarer.
david2ndaccount··on A Blog Post with Every HTML Element
Just use b and i, em and strong are bloat and are harder to type if you are hand-writing html. The semantic web is dead anyway.
david2ndaccount··on A Modern C Development Environment
Note that I am not advocating for just having a few shell scripts that invoke clang. The context is someone saying to use `zig build`, and linking a blog post where all they do is compile redis from scratch, including all dependencies from source except for libc. In that context, `zig build` is just a wrapper around clang. Nowhere in their comment or linked blog post is the issue of these real complexities you allude to addressed at all.

Now I personally would rather not use a pre 1.0 release of an entirely different programming language to compile my C projects instead of a cross-platform C compiler, but people can do whatever they want.

david2ndaccount··on A Modern C Development Environment
If you aren’t supporting more than one compiler, almost all of those tools vanish. You can just use clang.
david2ndaccount··on A Modern C Development Environment
Doesn’t seem to offer much over just using clang.
david2ndaccount··on Kitty – a fast, feature-rich, GPU based terminal emulator
I use kitty as my main terminal, it’s great.
david2ndaccount··on Car Bloat: “Huge Cars Are Terrible for Society”
The problem is they don’t make full-sized cars anymore (the “land yachts”). To get a comfortable car, you need to buy a truck or essentially a truck (SUV).
david2ndaccount··on No telemetry in the Rust compiler: metrics without betraying user privacy
I doubt this will be well received, mostly due to the author’s problematic framing of the problem. This is not telemetry, it is just additional local logging. I don’t understand why it’s being framed as telemetry. Just say rustc is (optionally) logging more by default and the compiler people are writing tools that can analyze those logs if you choose to upload them.

Separately it sounds like rustc needs to do a better job collecting crash data that can be easily attached to a bug ticket.

← PreviousPage 3 of 10Next →