Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

Linus Torvalds explains "taste" in code by showing how to remove an entry from a singly linked list in C without adding extra complexity. Source: TED

8,910,656 görüntüleme • 1 yıl önce •via X (Twitter)

10 Yorum

tetsuo.ai profil fotoğrafı
tetsuo.ai1 yıl önce

Source:

🇵🇹Ninja Dynamics☀️🌴🍹 profil fotoğrafı
🇵🇹Ninja Dynamics☀️🌴🍹1 yıl önce

Oh man, seeing how elegantly a simple linked list can be optimized really blew my mind! Beautiful! Linus really is the goat!

dinn profil fotoğrafı
dinn1 yıl önce

"Better taste" would not work if entry is a value, not a list element that needs to be deleted. Last string needs indirect->next

Kevin Dai profil fotoğrafı
Kevin Dai1 yıl önce

I'd argue the first one is better *because* it's more intuitive and understandable (biased as a compiler developer). In reality, the compiler has no trouble optimizing this trivial logic: and actually yields better code in the "untasteful" one (1/3)

Ghasem Ramezani profil fotoğrafı
Ghasem Ramezani1 yıl önce

Looking at the problem from a different perspective is extremely hard when you are in the problem. 😫

Araf profil fotoğrafı
Araf1 yıl önce

had to do some soul searching

wundram profil fotoğrafı
wundram1 yıl önce

That while loop tastes pretty sour.

Teobastus profil fotoğrafı
Teobastus1 yıl önce

But it doesn't really handle the case where you reach the end of the list without finding the element you're looking for. If you reach the end it will crash and probably segfault.

Method profil fotoğrafı
Method1 yıl önce

“code taste”

Noga Navon🏳️‍⚧️ الزهرة الحكيمة נוגה נבון profil fotoğrafı
Noga Navon🏳️‍⚧️ الزهرة الحكيمة נוגה נבון1 yıl önce

This is the kind of thing that make having pointers in your language worth it.

Benzer Videolar