HNHacker News
TopNewBestAskShowJobs

plq

1,366 karma · joined April 2, 2010

github.com/plq ext-hn@burakarslan.com
submissionscomments
plq··on SGCL: Real-time garbage collector for C++
You use custom memory management where it matters, gc anywhere else.
plq··on C++23: std:out_ptr and std:inout_ptr
> Instead of reducing bugs, these might be introducing new footguns.

Same thing could be/has been said about std::string_view or std::span but here we are.

Like you said, a bare pointer could mean anything. This at least standardizes this particular footgun in question (which means one less reason to expose bare pointers in your API) so we are supposed to pay extra attention when we see one of those, I guess?

plq··on Mildly interesting quirks of C
Whenever the subject of C/C++ quirks is brought up, I always like to point out the Deep C/C++ presentation:

http://www.pvv.org/~oma/DeepC_slides_oct2011.pdf

Source: https://freecomputerbooks.com/Deep-C-and-Cpp.html#downloadLi...

Previous discussion: https://news.ycombinator.com/item?id=3093323

It could be considered a bit dated at this point (It's before C++11) but I find it still both entertaining and educating.

plq··on Devenv.sh: Fast and reproducible developer environments using Nix
We are using Gentoo Prefix [1] project to set up our development environment on linux. Containers etc. aren't needed as long as the elf interpreter path and rpath are set up correctly when linking the executable (or with patchelf afterwards).

Highly recommended.

[1]: https://wiki.gentoo.org/wiki/Project:Prefix

plq··on Inside boost::unordered_flat_map
There isn't one std::map though, each C++ stdlib has its own.
plq··on Tesla engineers were on-site to evaluate the Twitter staff’s code, workers said
I don't think we disagree. You don't like the company you work for? You Quit. You think it's not the company you joined some time ago? You Quit. I can go on and on like this. You didn't promise to increase shareholder value, but you did promise you would try in good faith.

None of this justifies willfully harming your employer.

Edit: One of the things that is an exception I believe is whistle blowing. You may expose stuff you deem unacceptable or harmful to the general public. But I guess that's about it. Of course this all depends on your jurisdiction.

plq··on Tesla engineers were on-site to evaluate the Twitter staff’s code, workers said
> ... running twitter into the ground might be the most ethical thing an employee could do.

Is this what you said during your hypothetical interview with Twitter? If yes, be my guest. If not, you should abide by the promises you made to your employers.

It's got nothing to do with "self-imposed honor code" or whatever terms people come up with to belittle people with integrity. You made a promise when you accepted that offer. You either stand by that or quit.

plq··on Webamp – Winamp 2 in the Browser
Those of you who wondered (like me) how the (possibly) copyrighted music might have so easily and seamlessly reached your ears, behold: https://github.com/captbaritone/webamp-music

Also: https://github.com/captbaritone/webamp/blob/master/packages/...

plq··on Zstd Compressed Debug Sections
I get that compressed .debug sections are nice for users who would generate the occasional stack trace, but if you are a developer of eg. a qt-based app with tons of dependencies and lots of plugins (meaning lots of addt'l calls to dlopen after the elf interpreter is done) I find it's actually harmful because it slows down gdb.

NVMe and lots of ram (for caching) are your friends.

plq··on Why 12 notes in Western music?
The system of the Turkish Classical Music is a bit different:

* https://www.sufi.gen.tr/nota-sistemi/en

* http://www.turkishmusicportal.org/en/types-of-turkish-music

plq··on Mainnet Merge Announcement
By "A few", how much do you mean? Or is that a dynamic number? How does it get defined? Who can change it later, if it's mutable?
plq··on GitHub deleted accounts of people who contributed to Tornado Cash repos
As an example, it seems plausible to me that a person who wants to enter the cryptocurrency sector could send a pull request and actually work with them to get merged to put it in their resume.

This person can be totally oblivious to the illegal stuff that's happening behind the scenes. After all they were just trying to prove that they actually have experience with cryptocurrency code to potential future employers.

It also can be some random security researcher who is preventing open source developers from shipping vulnerable code. I know for a fact that Github themselves employ such people that send security-related patches from time to time to open-source projects.

You can work up more examples -- my point is that people who definitely have nothing to do with any illegal activity whatsoever could exist in the list of contributors of these repositories.

It's nice that they didn't just nuke the whole contributors list, but it's still a bit unsettling.

> it's your responsibility to know and check who you are dealing with.

What can I say, duly noted.

plq··on GitHub deleted accounts of people who contributed to Tornado Cash repos
Be that as it may, isn't this still an unacceptable collateral damage?

So when you contribute code to an open source project, you generally do so under an open source license. All of them generally contain something akin to the following:

    IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(this particular excerpt is from the BSD license)

I can understand taking action against the people who run the code. I can even understand taking action against people who were hired to contribute. But why kick some random open source contributor in the guts? What did they do wrong?

Are there open source licenses that protect the contributors from such unforeseeable damage? Or are we to watch our step from now on as open source contributors?

plq··on We're improving search results when you use quotes
Can you share a link to this specific one? He seems to be a pretty active speaker.
plq··on Starlink Maritime
When I brought this video up, I just wanted to provide a voice from the other side of the debate. I did not really verify its contents and wanted to hear what other people had to say about it.

I'm familiar with the mobile satellite sector and I can say for a fact that he is right about the cost of the terminal being couple times higher than $500, though getting at the exact number would require a considerable amount of digging.

I got things to say about the attitude in this micro-thread though: I'm sure y'all heard the saying "If you don’t read the newspaper, you’re uninformed. If you do, you’re misinformed". I like that quote, but I always felt like some elaboration should follow.

By all means, do watch/read/consume anything and everything, and first use introspection, ie. ask yourself "Am I qualified/informed/sane enough to reach a conclusion about this matter?", and if your answer is yes then use your critical thinking neurons to reach YOUR conclusion. Then still try to verify it with your peers, or if you can find any, experts in that particular field. Personal attacks (along with other logical fallacies) have no place in a civilised discussion.

Basing on the above, if the Starlink opposers are as desperate as you say about distorting the facts to advance their narrative, it only increases my confidence in the project. You see, I did not end up being delusional, just reached a logical conclusion to the extent of my abilities.

So all in all, thanks for taking the time to write this up.

plq··on Starlink Maritime
He claims the terminal costs at least 3× the retail price and will never make a profit because of it

He also claims that its product offering brings nothing new to the table compared to hughesnet and viasat which is wrong imo as offering 1/10th latency of these products is a gamechanger.

Sorry, I'd do better but I'm on mobile, I think it's worth a watch at 1.5×

plq··on Starlink Maritime
I came across this guy recently:

https://m.youtube.com/watch?v=2vuMzGhc1cg&feature=youtu.be

Looks to me that you forgot about the consumer-side terminal.

plq··on Bitcoin slumps below key $20k threshold
Sure, but the price of gold doesn't really follow industry trends -- it's got more to do with the fact that it's a historical store of value / object of desire for the masses.
plq··on Important PostgreSQL 14 update to avoid silent corruption of indexes
It is slow. Our (C++) project's MSVC release build ends with a glorious 2-minute run of link.exe with lto (/LTCG /O2) and aggressive inlining (/Ob3) enabled.

Limiting unit size in C++ helps with faster edit/compile/run cycles as well, which doesn't seem to be concern for C codebases in 21st century.

plq··on Important PostgreSQL 14 update to avoid silent corruption of indexes
While I'm not sure that was a consideration here, sometimes C compilers produce better machine code when they got access to more function definitions. Eg. Sqlite recommends that embedders use the single ~10mb sqlite.c file[1] for both ease of use and performance reasons.

[1]: https://www.sqlite.org/amalgamation.html

plq··on No-op statements syntactically valid only since Python X.Y
You can split your big module into modules inside a sub-package and import stuff in the __init__.py file from the submodules to present a nice interface to the library user.

eg instead of:

    namespace.py
        class C1:
        class C2:
do

    namespace/__init__.py
        from .c1 import C1
        from .c2 import C2

    namespace/c1.py
        class C1:

    namespace/c2.py
        class C2:
plq··on Re-implementing an old DOS game in C++ 17 (2019)
Be sure to read author's response(s) to comments below the post. Some insights about why C++17 doesn't help with reducing the size of the codebase:

> My version (...) has to convert the data into formats usable by modern video and audio APIs (...) in an endian-independent way, and adds quite a few correctness checks (...) instead of triggering undefined behavior

> the original can basically do a memcpy to show something on screen, I need 1000 lines of OpenGL code…

> I don’t have global variables, but this in turn means more boilerplate to inject dependencies into objects on construction etc.,

> I try to be fairly type-safe, which sometimes means needing more code, additional data transformations etc.

plq··on Show HN: Redditle.com – For those of us who add 'Reddit' to every Google search
This looks nice, congrats on shipping :)

Did you know that "Redditle" literally means either "with Reddit" or "Reddit it" in Turkish depending on context and is actually the perfect Turkish name for a service that does something using Reddit?

As a similar example, Turkish for "Google it" is "Google'la". To google is "Google'lamak".

PS: The suffixes le/la are the same, vowels in suffixes generally adapt to the word that the get attached to due to vowel harmony.

plq··on SQLite B-Tree Module
> It looks like SQLightning got adopted and has been worked on by the SQLite team under the name LumoSQL.

Sorry about this misinformation, it looks like Sunday morning sleepiness got me.

It rather looks like LumoSQL is maintained by an independent group of engineers who seem to be quite familiar with the sqlite codebase and tooling.

plq··on SQLite B-Tree Module
This has been shared without context but I guess the SQLite team is starting to modularize the btree code in order to facilitate work like SQLightning: https://github.com/LMDB/sqlightning

At the time SQLightning greatly improved SQLite performance but due to LMDB's requirement to have keys fit in 2/3 of a page it wasn't really useful as a general purpose replacement of SQLite's internal b-tree implementation.

EDIT: It looks like SQLightning got adopted and has been worked on by the SQLite team under the name LumoSQL. Here's the project's readme: https://lumosql.org/src/lumosql/doc/trunk/README.md which contains at the end "A Brief History of LumoSQL"

plq··on US Senate votes unanimously to make daylight savings time permanent
Well, Turkey has moved from UTC+2 plus DST in summer to UTC+3 permanently.

People seem to hate it. Here's a news report lamenting the decision:

https://www-cumhuriyet-com-tr.translate.goog/turkiye/kalici-...

Personally, I'm happy that we get more sunlight after work hours but people who need to get up early (especially children who get up early to go to school) reportedly are frustrated with it.

I'm trying to find a pro-permanent-DST article but not having much success with it.

Here's a more balanced take on the issue with psychologists chiming in:

https://tr-sputniknews-com.translate.goog/20211123/kalici-ya...

Here's a non-newspaper source (don't miss the references bit in the end if you're interesed):

https://bilimveaydinlanma-org.translate.goog/kalici-yaz-saat...

It objectively seems like a bad idea, It appears Turkey should move back to UTC+2 and stay there. Permanent DST has many downsides.

plq··on KDE: A Nice Tiling Environment and a Surprisingly Awesome DE
Sure, KDE is awesome, but "Surprisingly Awesome"? The author is surprised that eg. "The shortcut settings in KDE really work and are impressive. " or "I can put [the panels] at the top of the screen, the bottom, or even the sides!"

Seriously? Isn't it weird that people can be impressed by keyboard shortcuts working or apps being able to put an icon in the system tray in the year of 2022?

Disclaimer: I have been a KDE user since the first time I managed to boot into the graphical shell on my Gentoo box back in early noughties. That's it, just a happy user.

KDE has been around for 25+ years. It has a huge community: Both a substantial amount of users and a daring team that is totally chill not only about diving head-first into colossal amount of work, but also about making substantial changes to its codebase when they think it's necessary. Just look at how much work went into migrating KDE 3 to 4 or splitting kdelibs when going 4 => 5 which is the status quo now.

It's also got a solid legal foundation[1], better than relying on just GPL. They got flak when they first decided to build on Qt, a commercial framework so they negotiated this deal with Trolltech. (EDIT: Here's the context[2]) The point is that their dedication to the community is also top notch, which seems rare in the open source world.

So I, for one, am not one bit surprised that a team this competent managed to get keyboard shortcuts to work after all. Actually, I'll go one step further and say this: If your daily driver is Linux and you are not forced to running Fluxbox/Openbox/etc. due to resource constraints, you should be running KDE, period.

What's next, we will praise Linux for doing preemptive scheduling? Come on :)

[1]: https://kde.org/community/whatiskde/kdefreeqtfoundation/ [2]: http://openbooks.sourceforge.net/books/kde20devel/ch19lev1se...

PS: I see comments talking about eg. how bad the early 4.x releases were. Well, that's mainly Ubuntu's fault for shipping a barely finished tech preview in its stable channel. I, for one, don't remember having a problem switching to KDE 4.something once it was offered in the stable channel by the Gentoo KDE team.

plq··on Consider SQLite
To my knowledge, WAL mode still needs to serialize writes for each database file. I'm assuming this is not a setup where there are too many concurrent writers?
plq··on Ask HN: Why is building Windows apps so complicated?
A common mistake I see is to let the tools/frameworks make the decisions. The engineer should make the decisions. If the tools don't let the engineer do what he wants, he must change the tools.

Not sure how much experience you have with native development but, as a person who has production code running on windows, macos and linux, frankly I don't see much difference. Getting together almost all of the moving parts that make a modern OS tick behind simple API calls is no simple feat. Native development is complex because ... well it's a complex problem. Microsoft platforms have always been clunky so if you add that as well, it might seem unsurmountable if you don't know what you're looking for.

Linux is the most developer-friendly OS out there. What's nice, its GUI toolkits have the advantage of being cross-platform so if you learn how to use them, you can easily port your code to other platforms. For windows development I'd go with Qt or Gtk instead of full-on native nowadays. Qt takes you %95 of the way (Gtk a bit less) and for what's left you can drop to native code which wouldn't be too difficult.

However, for the sake of argument, let's try using the native apis.

Here's the checklist: Get a compiler, get an editor, write some code, generate build files, build, run, iterate.

1. Get a compiler. For windows, MSVC is the obvious choice. My MSVC provisioning script is 40 lines of powershell plus some json file I exported after doing the first manual install.

2. Get an editor. Notepad++ will let your feet get wet but for advanced stuff like completion and refactoring, get a real IDE like Qt Creator, Visual Studio or CLion. But for now, notepad++ it is.

3. Ok, time to write some code. I DuckDuck "windows gui hello world" and clicking around the first result lands me here: https://docs.microsoft.com/en-us/windows/win32/learnwin32/yo... so we have our hello world sample. Get the code from there and save it as main.cpp

4. Now let's compile the code. Running cl.exe by hand is doable but won't take you very far. We need a build configuration system. It looks like CMake and ninja is now bundled with Visual Studio so let's use them. I DuckDuck "cmake windows hello world" but don't get much and you turn to Google and you get these three lines:

    cmake_minimum_required(VERSION 2.4)
    project(hello_world)
    add_executable(app WIN32 main.cpp)
Good! now, launch a developer shell and do this:

    cd \path\to\my\code
    mkdir build
    cd build
    cmake ..
And when I type make ... wait what is this? What is a .sln file?? Visual Studio Solution?? Sorry cmake, that's not what I want, give me a proper Makefile. Or build.ninja.

Let's try again:

    cd ..
    rm -r build
    mkdir build
    cd build
    cmake .. -G Ninja
    ninja
    .\app.exe
Ah! That's more like it. And you take it from there.

Never let your tools dictate your actions. You're the engineer. The tools should do your bidding. As for the framework, just use Qt. If not, I think the latest fad is WinUI but Win32/MFC is here forever.

I actually put all this here along with my MSVC Provisioning script: https://github.com/plq/hello-win32

Hope it helps!

plq··on PLOS2021: ISO-C became unusable for operating systems
ADA has this exact functionality: https://www.adaic.org/resources/add_content/standards/05aarm...

Look for the "range" keyword

← PreviousPage 4 of 13Next →