frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Costs and Benefits

1•dcdropbox•1h ago
"There are no zero-cost abstractions" (https://www.youtube.com/watch?v=rHIkrotSwcc) is a good CppCon talk. It tells as to look for costs and benefits. For the C++ Core Guideline's Month abstraction here are what I see as the costs and benefits. Your choice whether you feel the benefits outweigh the costs :

#include <iostream>

// Guideline P1 is about expressing ideas directly in code. One part of that is // about using user defined types that express an idea better than say an int. // This file takes the Date/Month example in P1 and expands upon it.

// Neutral 1 : Despite wrapping the unsigned int it is no slower.

struct CalendarType { // Neutral 2 : The user does not know if the value is 0 based or 1 based.

   unsigned int value;

   // Cost 1 : Either the user has to use say month.value or we have to write boiler plate code for required methods.
   // Mitigation 1 : C++ 20 boiler plate for comparison operators is a couple of one liners.

   bool operator==(const CalendarType &other) const = default;
   std::strong_ordering operator<=>(const CalendarType &other) const = default;
};

// Cost 2 : We have a bit of boiler plate code to write. // Mitigation 2 : We've put the common code into a base class.

struct Year : CalendarType { explicit Year(int year) : CalendarType(year) {} };

struct Month : public CalendarType { explicit Month(int month) : CalendarType(month) {} };

struct Day : public CalendarType { explicit Day(int day) : CalendarType(day) {} };

class Date { public: Date(Year year, Month month, Day day) : m_year(year), m_month(month), m_day(day) { }

   Year year() const
   {
      return m_year;
   }

   Month month() const
   {
      return m_month;
   }

   Day day() const
   {
      return m_day;
   }
private: // Cost 3 : To fully understand, the reader needs to look at how Year, Month and Day are implemented.

   Year m_year;
   Month m_month;
   Day m_day;
};

int main() { // Cost 2 :

   Date date1 {Year(1970), Month(4), Day(7)};   // Benefit 1 : It's clear to the reader what each argument is.
   Date date2 {Year(1983), Month(1), Day(12)};
   // Date date3 {7, 4, 1979};                  // Benefit 2 : Code writer can't get them in the wrong order
                                                // (courtesy of explicit this wont compile).


   // (Yes, I've glossed over leap year edge cases)
   bool earlierInTheYear = date2.month() < date1.month() ||
        date2.month() == date1.month() && date2.day() < date1.day();

   std::cout << "1983-01-12 " << (earlierInTheYear ? "is" : "is not")
             << " earlier in the year than 1970-04-07" << std::endl;
}

OpenAI loses song lyrics copyright case in German court

https://www.dw.com/en/openai-loses-song-lyrics-copyright-case-in-german-court/a-74698240
1•pimeys•30s ago•0 comments

The No. 1 Country Song in America Is by a Non-Human Artist

https://www.thedailybeast.com/the-no-1-country-song-in-america-is-by-a-non-human-artist/
1•Brajeshwar•1m ago•0 comments

Netzbremse – Deutsche Telekom is throttling the Internet

https://netzbremse.de/en/speed/
1•CrLf•2m ago•0 comments

Cold Truth

https://drexel.edu/westphal/academics/undergraduate/graphic-design/polishpostercollections/cold-t...
1•jruohonen•5m ago•0 comments

I built an unlimited AI video generator powered by Sora 2

https://powervideo.net/
1•LeoWood42•6m ago•1 comments

Raft Consensus in 2k Words

https://news.alvaroduran.com/p/raft-consensus-in-2000-words
1•ohduran•9m ago•0 comments

Diving into Reactive Programming in Node.js

https://blog.appsignal.com/2025/11/12/diving-into-reactive-programming-in-nodejs.html
1•amalinovic•10m ago•0 comments

Ethics isn't about being a good person

https://www.lableaks.dev/p/ethics-isnt-about-being-a-good-person
2•didgeoridoo•11m ago•0 comments

GLP-1 receptor agonists on five-year mortality in patients with colon cancer

https://www.tandfonline.com/doi/full/10.1080/07357907.2025.2585512
1•01-_-•12m ago•0 comments

RF and Microwave Power Amplifiers

https://us.artechhouse.com/RF-and-Microwave-Power-Amplifiers-P2436.aspx
1•teleforce•13m ago•0 comments

Async and Finaliser Deadlocks

https://tratt.net/laurie/blog/2025/async_and_finaliser_deadlocks.html
2•todsacerdoti•13m ago•0 comments

EU Violates Case Law in Proposed GDPR Big Tech AI Training Carve-Out

https://noyb.eu/en/eu-commission-about-wreck-core-principles-gdpr
2•piltdownman•20m ago•2 comments

Israeli settlers set fire to Palestinian warehouse and land

https://www.bbc.com/news/articles/c78zygz4xg9o
8•dependency_2x•20m ago•2 comments

Show HN: Design canvas integrated into your AI IDE

https://www.velork.com/
1•alielroby•22m ago•0 comments

TimeClout: A New, Open-Source Tool to End Shift Scheduling Headaches

https://metaduck.com/announcing-timeclout-private-beta/
1•pgte•23m ago•0 comments

Ask HN: How does one stay motivated to grind through LeetCode?

2•blutoot•25m ago•0 comments

Django-Tailwind v4.4: Now with Zero Node.js Setup via Standalone Tailwind CLI

https://timonweb.com/django/django-tailwind-v44-now-with-zero-nodejs-setup-via-standalone-tailwin...
1•bobjackson•26m ago•0 comments

Datephotos.ai

https://datephotos.ai
1•jacobgor502•27m ago•0 comments

HackGPT Enterprise, AI-Powered Penetration Testing Platform

https://github.com/yashab-cyber/HackGpt
2•salkahfi•27m ago•0 comments

I Think the BBC's Future Is Bleak

https://livelyclock.substack.com/p/why-i-think-the-bbcs-future-is-bleak
2•thomasfromcdnjs•29m ago•0 comments

How should open source software projects handle AI‑generated code?

https://manualdousuario.net/en/open-source-ai-code-keepassxc/
1•rpgbr•30m ago•0 comments

Aspire – Your Stack, Streamlined

https://aspire.dev/
1•styx31•31m ago•0 comments

Loom – An event-driven OS for AI agents, built by a college junior in 10 days

https://github.com/loom-os/loom
2•JaredforReal•32m ago•1 comments

Checklist for Preventing Browser Fingerprinting

https://cloudexplorer.ai/checklist-preventing-browser-fingerprinting/
1•BlackPlot•34m ago•0 comments

Pakistani newspaper mistakenly prints AI prompt with the article

https://twitter.com/omar_quraishi/status/1988518627859951986
15•wg0•34m ago•2 comments

What is Purchasing power parity and why you may implement it?

https://hugo.writizzy.com/purchasing-power-parity-ppp/4ea79d1b-988e-4a9f-8d0f-3d7557703fb5
1•hlassiege•36m ago•0 comments

Mls-chat: Example client/server for the MLS protocol based on OpenMLS

https://github.com/q10elabs/mls-chat
1•knz42•37m ago•1 comments

Infrastructure or Intrusion?

https://algorithmwatch.org/en/infrastructure-intrusion-conflict-data-center/
1•jruohonen•40m ago•0 comments

Google vows to stop scam E-Z Pass and USPS texts plaguing Americans

https://arstechnica.com/tech-policy/2025/11/google-vows-to-stop-scam-e-z-pass-and-usps-texts-plag...
4•BlackPlot•46m ago•0 comments

Helios: A 98-qubit trapped-ion quantum computer

https://arxiv.org/abs/2511.05465
1•fuglede_•48m ago•0 comments