What is Hackers' Pub?

Hackers' Pub is a place for software engineers to share their knowledge and experience with each other. It's also an ActivityPub-enabled social network, so you can follow your favorite hackers in the fediverse and get their latest posts in your feed.

0

Nรกvลกtฤ›vnรญci bruselskรฉho Festivalu svฤ›tel si mohou letos opฤ›t prohlรฉdnout i instalaci od zรกstupce z ฤŒeska. Dรญlo nazvanรฉ Synapse ฤeskรฉho vรฝtvarnรญka Jana Poลกe je k vidฤ›nรญ pล™รญmo v centru mฤ›sta.

0
0
0
0
1
1

fedibirdใ€้ŽๅŽปใฎๆŠ•็จฟใฏ่ฆ‹ใ‚Œใชใ„ใ‘ใฉๆœ€่ฟ‘ใฎๆŠ•็จฟใฏ่ฆ‹ใ‚Œใ‚‹ใฎใงfedibirdใ‹ใ‚‰ๆš—ใซใ€ŽTLใ‚’ๅ…จ้ƒจ่ฟฝใ†ใฎใฏใ‚„ใ‚ใ‚ใ€ใฃใฆ่จ€ใ‚ใ‚Œใฆใ‚‹ใ‹ใ‚‚

1

์ €๊ธฐ์š” ๋ฐค์ˆœ์”จ ๊ทธ๋Ÿฌ์‹œ๋ฉด ๋‚ด๊ฐ€ ๋‹น์‹  ์˜ท์„ ๋ชป์ž…ํ˜€๋“œ๋ ค์š” (๋’ท๋‹ค๋ฆฌ์ชฝ ๊ณ ์ • ๊ณ ๋ฆฌ ๊ฑธ์–ด์ค˜์•ผํ•˜๋Š”๋ฐ ์ด๋ชจ ์† ๋ƒ…๋‹ค ๊น”๊ณ ์•‰์€๋ถ„)

0

Hamas says Israeli massacres continue despite upcoming Board of Peace meeting

โ€œThis criminal escalation comes ahead of the Board of Peace meeting, in a clear attempt to impose a bloody reality on the ground and send a message that all efforts and bodies concerned with establishing calm in Gaza are meaningless, and that the occupation is continuing its aggression despite all parties speaking of the necessity of adhering to the ceasefire agreement.โ€




0
0

็ฏๆฒนใซใ‚ฌใ‚ฝใƒชใƒณๆททๅ…ฅใ‹ใ€€ๅฒ้˜œใƒปๅคงๅžฃๅธ‚ใฎใ‚ฌใ‚ฝใƒชใƒณใ‚นใ‚ฟใƒณใƒ‰ใ€€ไฝๅฎ…ๅ…จ็„ผใฎ็ซ็ฝใ‚‚ใ€€ๆถˆ้˜ฒใŒๆณจๆ„ๅ‘ผใณใ‹ใ‘ใ€€ - ใƒฉใ‚คใƒ–ใƒ‰ใ‚ขใƒ‹ใƒฅใƒผใ‚น

2ๆœˆ9ๆ—ฅใซๅคงๅžฃๅธ‚ๅ†…ใงไฝๅฎ…ใŒๅ…จ็„ผใ™ใ‚‹็ซไบ‹ใŒใ‚ใ‚Šใ€ๆถˆ้˜ฒใŒๅŽŸๅ› ใ‚’่ชฟในใŸใจใ“ใ‚ใ€็ซๅ…ƒใจใชใฃใŸใƒ•ใ‚กใƒณใƒ’ใƒผใ‚ฟใƒผใซไฝฟ็”จใ•ใ‚ŒใŸ็ฏๆฒนใฎไธญใซใ‚ฌใ‚ฝใƒชใƒณใŒๅซใพใ‚Œใฆใ„ใŸใ“ใจใŒๅˆ†ใ‹ใฃใŸใจใ„ใ†ใ“ใจใงใ™ใ€‚
ๅˆคๆ˜Žใ—ใŸๅŽŸๅ› ใŒใ‚ใพใ‚Šใซใ‚‚โ€‹:kowaihanashi:โ€‹

0
ๅŒฟๅ่ณชๅ•็ฎฑใ‚ตใƒผใƒ“ใ‚นMewkใ‚’ไฝœใ‚Šใพใ—ใŸโ€‹:blobcatphoto:โ€‹

ใƒปMFMใ‚„ใ‚ซใ‚นใ‚ฟใƒ ็ตตๆ–‡ๅญ—ใ‚’ใใฎใพใพไฝฟใฃใฆ่ณชๅ•ใƒปๅ›ž็ญ”ใงใใ‚‹
ใƒปๅ›ž็ญ”ใฏใใฎใพใพMisskeyใซๆŠ•็จฟใงใใ‚‹
ใƒปใƒ•ใƒฌใƒผใƒ ใ‚นใ‚ฟใ‚คใƒซใ‚„ใ‚ซใƒฉใƒผใ‚’่‡ช็”ฑใซใ‚ซใ‚นใ‚ฟใƒžใ‚คใ‚บๅฏ่ƒฝ
ใƒป่‡ชๅ‹•ใงไธๅฟซใช่ณชๅ•ใ‚’ใƒ–ใƒญใƒƒใ‚ฏ

Misskeyใ‚‰ใ—ใ„่ฆ‹ใŸ็›ฎใƒปๆ›ธใๆ–นใ‚’ๅดฉใ•ใšใซไฝฟใˆใ‚‹ใฎใŒ็‰นๅพดใงใ™
MiAuthใซๅฏพๅฟœใ—ใฆใ„ใ‚‹ใฎใงใ€Misskeyใ‚ขใ‚ซใ‚ฆใƒณใƒˆใงใใฎใพใพใƒญใ‚ฐใ‚คใƒณใงใใพใ™ใ€‚
ใ‚ˆใ‹ใฃใŸใ‚‰ไฝฟใฃใฆใฟใฆใใ ใ•ใ„ใ€œ

https://mewk.app/
1

๐“ฒเฎฃ๐ŸŒ€

โ†’้€ใ้€šใฃใŸใ‚คใ‚ซใŒๆดพๆ‰‹ใชๆจกๆง˜ใ‚’ๆผ”ๅ‡บใ€€็†็”ฑใฏๆฑ‚ๆ„›ใ€€ๆฑๅคงใชใฉ็™บ่ฆ‹
mainichi.jp/articles/20260214/

0

โ€œ์–ธ์  ๊ฐ€ ์ž์•„ ํ˜•์„ฑ, ์˜ณ๊ณ  ๊ทธ๋ฅธ ๊ฒƒ ๊ฐ€๋ฅด์ณ์•ผโ€โ€ฆAI์— ์œค๋ฆฌ ํ•™์Šต์‹œํ‚ค๋Š” ์—ฌ์„ฑ ์ฒ ํ•™์ž n.news.naver.com/mnews/articl... ๊ธฐ์ˆ ์˜ ์ •์ ์— ์œค๋ฆฌ์™€ ์ฒ ํ•™ ์ „๋ฌธ๊ฐ€๊ฐ€ ๊ฐœ์ž…ํ•˜๊ณ  ์žˆ๋‹ค๋Š” ๊ฒƒ๋„ ์˜๋ฏธ์žˆ๋Š” ๋ถ€๋ถ„์ด ์•„๋‹๊นŒ ์‹ถ๋‹ค.

โ€œ์–ธ์  ๊ฐ€ ์ž์•„ ํ˜•์„ฑ, ์˜ณ๊ณ  ๊ทธ๋ฅธ ๊ฒƒ ๊ฐ€๋ฅด์ณ์•ผโ€โ€ฆAI์— ...

0
0
0
0

ใใ‚“ใชใจใใฏmisskey pay๏ผ

misskey payใ‚’ไฝฟใ†ใจใŠๅบ—ใ‹ใ‚‰ใฎ่ซ‹ๆฑ‚้กใ‚’ใ—ใ‚…ใ„ใ‚ใ•ใ‚“ใ‹ๆ‘ไธŠใ•ใ‚“ใซๆ”ฏๆ‰•ใ†ใ“ใจใŒๅ‡บๆฅใพใ™๏ผ

1

v.daum.net/v/2026021515... "์žฅ๋™ํ˜ ๊ตญ๋ฏผ์˜ํž˜ ๋Œ€ํ‘œ๋Š” ์ฃผํƒ 6์ฑ„๋ฅผ ๋ณด์œ ํ•œ ๋‹ค์ฃผํƒ์ž์ด๊ณ  ๊ตญ๋ฏผ์˜ํž˜ ๊ตญํšŒ์˜์›๋“ค ์ค‘ 10๋ช… ์ค‘ 4๋ช…์€ ๋‹ค์ฃผํƒ์ž๋กœ ๋ชจ๋‘ 42๋ช…์ด๋‚˜ ๋œ๋‹ค"๋ฉฐ "๋ณธ์ธ๋“ค ๋‹ค์ฃผํƒ์—๋Š” '์ž…๊พน๋‹ซ'ํ•˜๊ณ , 1์ฃผํƒ์ž์ธ ์ด์žฌ๋ช… ๋Œ€ํ†ต๋ น์ด ํ‡ด์ž„ ํ›„ ๋Œ์•„๊ฐˆ ํ•˜๋‚˜ ์žˆ๋Š” ์ง‘์„ ํŒ”์ง€ ์•Š๋Š”๋‹ค๊ณ  ๋น„๋‚œํ•˜๋Š” ๋ชจ์Šต์€ ๊ฒฝ์ด๋กœ์šธ ์ •๋„" ๊ทธ๋Š” ๊ตญ๋ฏผ์˜ํž˜์„ '๋ถ€๋™์‚ฐ๋ถˆ๋กœ์†Œ๋“์ง€ํ‚จ๋‹น'์ด๋ผ ์นญํ•˜๋ฉฐ (์ค‘๋žต) "๊ตญ๋ฏผ์˜ํž˜์ด ์ง€ํ‚ค๊ณ ์ž ํ•˜๋Š” ๊ฐ€์น˜์™€ ๋‹น์˜ ์ง€ํ–ฅ์ ์„ ์˜จ์ „ํžˆ ๋‹ด์•˜๋‹ค"๋ผ๊ณ  ๋ง๋ถ™์˜€๋‹ค.

[์†๋ณด] ๋ฏผ์ฃผ๋‹น, ๊ตญํž˜์— "์žฅ๋™ํ˜ 6์ฑ„, ์˜์› 41๋ช… ...

[์†๋ณด] ๋ฏผ์ฃผ๋‹น, ๊ตญํž˜์— "์žฅ๋™ํ˜ 6์ฑ„, ์˜์› 41๋ช… ๋‹ค์ฃผํƒ์žโ€ฆ๋‚ด ๋‹ค์ฃผํƒ ๋‚ด๊ฐ€ ์ง€ํ‚จ๋‹ค๋Š” ์ง‘๋… ๋А๊ปด์ ธ"

ํ”„๋ ˆ์‹œ์•ˆ ยท ๋”๋ถˆ์–ด๋ฏผ์ฃผ๋‹น์ด ๊ตญ๋ฏผ์˜ํž˜์„ ๋‘๊ณ  "'๋‚ด ๋‹ค์ฃผํƒ์€ ๋‚ด๊ฐ€ ์ง€ํ‚จ๋‹ค'๋Š” ์ง‘๋…๋งˆ์ € ๋А๊ปด์ง„๋‹ค"๋ฉฐ ๊ฐ•ํ•˜๊ฒŒ ๋น„ํŒํ–ˆ๋‹ค. ๊น€ํ˜„์ • ๋ฏผ์ฃผ๋‹น ์›๋‚ด๋Œ€๋ณ€์ธ์€ 15์ผ ์„œ๋ฉด๋ธŒ๋ฆฌํ•‘์—์„œ "๊ตญ๋ฏผ์˜ํž˜์ด ๋Œ€ํ†ต๋ น์„ ์‹œ์ •์žก๋ฐฐ์— ๋น„๊ตํ•˜๊ณ , ๋Œ€ํ†ต๋ น์˜ ๋ฉ”์‹œ์ง€๋ฅผ ๋ง์žฅ๋‚œ์œผ๋กœ ์น˜๋ถ€ํ•˜๋Š” ๋“ฑ ์ƒ์‹ ๋ฐ–์˜ ์ž‘ํƒœ๋ฅผ ๋ฒŒ์ด๊ณ  ์žˆ๋‹ค"๋ฉฐ "๊ตญ๋ฏผ์˜ํž˜ ๋Œ€์‹  โ€˜๋ถ€๋™์‚ฐ๋ถˆ๋กœ์†Œ๋“์ง€ํ‚จ๋‹นโ€™์ด ์ข‹๊ฒ ๋”ฐ"๋ผ๊ณ  ์ฃผ์žฅํ–ˆ๋‹ค. ๊ทธ๋Š” "์žฅ๋™ํ˜ ๊ตญ๋ฏผ์˜ํž˜ ๋Œ€

v.daum.net ยท Daum | ํ”„๋ ˆ์‹œ์•ˆ

0
1
0
0
0
0

์†Œ๋‹ˆ๊ฐ€ ์ž‘๊ณก AI์˜ ํ•™์Šต (์›๊ณก) ๋ฐ์ดํ„ฐ๋ฅผ ํŠน์ •ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ์ˆ ์„ ๊ฐœ๋ฐœํ–ˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์›๊ณก์˜ ๊ถŒ๋ฆฌ ๋ณด์œ ์ž๊ฐ€ AI ์„œ๋น„์Šค์ธก์— ์„ค๋ช…, ๋Œ€๊ฐ€๋ฅผ ์š”๊ตฌํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. www.nikkei.com/article/DGXZ... (์œ ๋ฃŒ ๊ธฐ์‚ฌ)

ใ‚ฝใƒ‹ใƒผใ‚ฐใƒซใƒผใƒ—ใ€ไฝœๆ›ฒAIใฎๅญฆ็ฟ’ใƒ‡ใƒผใ‚ฟใ‚’็‰นๅฎšใ€€ๅ‰ตไฝœ่€…ใธใฎๅฏพไพก็ฎ—...

ใ‚ฝใƒ‹ใƒผใ‚ฐใƒซใƒผใƒ—ใ€ไฝœๆ›ฒAIใฎๅญฆ็ฟ’ใƒ‡ใƒผใ‚ฟใ‚’็‰นๅฎšใ€€ๅ‰ตไฝœ่€…ใธใฎๅฏพไพก็ฎ—ๅ‡บๅฏ่ƒฝใซ - ๆ—ฅๆœฌ็ตŒๆธˆๆ–ฐ่ž

ใ€ใ‚ทใƒชใ‚ณใƒณใƒใƒฌใƒผ=ไธญ่—ค็Žฒใ€‘ใ‚ฝใƒ‹ใƒผใ‚ฐใƒซใƒผใƒ—ใฏไบบๅทฅ็Ÿฅ่ƒฝ๏ผˆAI๏ผ‰ใŒใคใใฃใŸ้Ÿณๆฅฝใ‹ใ‚‰ๅญฆ็ฟ’ใ‚„็”Ÿๆˆใซไฝฟใ‚ใ‚ŒใŸๆฅฝๆ›ฒใ‚’ๅ‰ฒใ‚Šๅ‡บใ™ๆŠ€่ก“ใ‚’้–‹็™บใ—ใŸใ€‚ๆ—ขๅญ˜ใฎๆฅฝๆ›ฒใŒๅˆฉ็”จใ•ใ‚Œใฆใ„ใŸๅ ดๅˆใซใ€AIใฎ้–‹็™บๅ…ƒใซ่ชฌๆ˜Žใ‚„ๅฏพไพกใ‚’ๆฑ‚ใ‚ใ‚‹ใ“ใจใŒๅฏ่ƒฝใซใชใ‚‹ใ€‚ๅŒ็คพใฏ้Ÿณๆฅฝ็”ŸๆˆAIใŒ็”Ÿใฟๅ‡บใ™ๅŽ็›Šใ‚’ใ‚ฏใƒชใ‚จใƒผใ‚ฟใƒผใ‚‰ใซ้…ๅˆ†ใ™ใ‚‹ไป•็ต„ใฟใฅใใ‚Šใซใ‚‚ๅฝน็ซ‹ใคใจใฟใฆใ„ใ‚‹ใ€‚้Ÿณๆฅฝใ‚„ๆ˜ ๅƒใ€ๅ‡บ็‰ˆใชใฉใฎใ‚ณใƒณใƒ†ใƒณใƒ„ๅˆ†้‡Žใงใฏใ€AI้–‹็™บไผๆฅญใซใ‚ˆใฃใฆ่‘—ไฝœ็‰ฉใŒ็„กๆ–ญใงAIใฎๅญฆ็ฟ’ใ‚„็”Ÿๆˆใซ

www.nikkei.com ยท ๆ—ฅๆœฌ็ตŒๆธˆๆ–ฐ่ž

0
0

I think I just had THE fediverse moment:
Scrolling through my timeline watching text posts, photos, a peertube video...A short video.

"ah nice MTB video" , I thought. Until I saw the handle: someone@loops. Wait.. I see a loops here. This isn't just a video. This is a video on A DIFFERENT Service. And I can seamlessly interact with it.

A new service just integrated seamlessly into my timeline. No "connect your account", no "extra app", no "extra login", no, it's just there

This is

0
0
1
0
0
0
1

์—”๋“œํ•„๋“œ ์ตœ๊ทผ์— ์„ค๋ฌธ์กฐ์‚ฌ๊ฐ€ ์ž์ฃผ์˜ค๋Š”๋ฐ
์ผ๊ด€๋˜๊ฒŒ ์‚ฌ๋ฃŒ์ข€ ๋‹ฌ๋ผ๋Š” ์˜๊ฒฌ์ด ๋งŽ์€์ง€ ์ผ์ฃผ์ผ๋‹จ์œ„๋กœ ์‚ฌ๋ฃŒ๊ฐ€ ์ƒ๊ธฐ๊ณ ์žˆ๋‹ค....
โ€‹:blobcatgooglythumbsup:โ€‹

1
0

โ€œ์–ธ์  ๊ฐ€ ์ž์•„ ํ˜•์„ฑ, ์˜ณ๊ณ  ๊ทธ๋ฅธ ๊ฒƒ ๊ฐ€๋ฅด์ณ์•ผโ€โ€ฆAI์— ์œค๋ฆฌ ํ•™์Šต์‹œํ‚ค๋Š” ์—ฌ์„ฑ ์ฒ ํ•™์ž n.news.naver.com/mnews/articl... ๊ธฐ์ˆ ์˜ ์ •์ ์— ์œค๋ฆฌ์™€ ์ฒ ํ•™ ์ „๋ฌธ๊ฐ€๊ฐ€ ๊ฐœ์ž…ํ•˜๊ณ  ์žˆ๋‹ค๋Š” ๊ฒƒ๋„ ์˜๋ฏธ์žˆ๋Š” ๋ถ€๋ถ„์ด ์•„๋‹๊นŒ ์‹ถ๋‹ค.

โ€œ์–ธ์  ๊ฐ€ ์ž์•„ ํ˜•์„ฑ, ์˜ณ๊ณ  ๊ทธ๋ฅธ ๊ฒƒ ๊ฐ€๋ฅด์ณ์•ผโ€โ€ฆAI์— ...

0

Yes, you may be killed by falling human made space junk, but the odds remain small(ish) that will occur. The (almost inevitable) may also prevent future flights if all those in Low Earth Orbit start colliding, creating countless debris.

However, we *ALL* have to worry about the โ€˜chemical problemโ€™ being created by SpaceX et al in the upper atmosphere. I have been banging on about this for a while and the attached article summarises the science in an easy to understand way - I have pasted the bit about the โ€˜chemical problemโ€™ below because we *ALL* need to understand what the billionaires are doing to the planet while we are watching.

โ€”โ€”โ€”โ€”โ€”
Quote:

Debris on the ground attracts immediate attention, but atmospheric scientists are tracking a slower process with potentially larger consequences. When satellites vaporize in the mesosphere, 50 to 80 kilometers above Earth, they release clouds of vaporized metals that condense into aerosol particles. Those particles descend into the stratosphere, where Earthโ€™s protective ozone layer resides.

Aluminum is the element of greatest concern. Upon reentry, aluminum oxidizes into aluminum oxide nanoparticles. A single 250 kilogram satellite generates roughly 30 kilograms of these particles. Unlike chlorofluorocarbons, which directly destroy ozone, aluminum oxide acts as a catalyst. One particle can facilitate chemical reactions that destroy thousands of ozone molecules over decades without being consumed.

Researchers from the University of Southern Californiaโ€™s Department of Astronautical Engineering documented an eightfold increase in atmospheric aluminum oxides between 2016 and 2022, directly correlating with the proliferation of satellite constellations, a finding reported in detail by CNET. In 2022 alone, reentering satellites released an estimated 41.7 metric tons of aluminum, approximately 30 percent more than the natural input from micrometeoroids.

Projections based on current deployment schedules suggest annual aluminum oxide emissions could reach 360 metric tons, a 646 percent increase over natural background levels, according to research highlighted by Popular Mechanics. Because these particles take 20 to 30 years to descend into the ozone layer, the atmospheric chemistry of todayโ€™s satellite fleet will not manifest as measurable ozone loss until the 2040s. By then, the upper atmosphere could already be saturated with catalysts.

NASA high altitude sampling flights over Alaska in 2023 detected the signature of this process. At approximately 60,000 feet, instruments found that 10 percent of stratospheric sulfuric acid particles larger than 120 nanometers contained aluminum and other metals traceable to spacecraft reentries, according to data presented at the American Astronomical Society meeting that year. The atmosphere now bears a permanent chemical marker of human activity in space.
โ€”โ€”โ€”โ€”โ€”

indiandefencereview.com/starli

0
0
0
0
0

Heute im IT-Bereich arbeiten heiรŸt oft: Stellen werden gestrichen, Aufgaben nach Indien ausgelagert, ยปEffizienzยซ wird mit KI als Sparprogramm verkauft, Projekte werden kaputtgespart, Teams dauerhaft unterbesetzt, Budgets eingefroren, befristete Vertrรคge zur Normalitรคt gemacht und Wissen รผber Jahre hinweg entsorgt โ€“ Hauptsache die Excel-Zeile sieht gut aus.

Und danach wird ernsthaft gejammert, es fehlten ยปFachkrรคfteยซ. Nein. Es fehlen keine Fachkrรคfte. Es fehlt der Wille, Leute auszubilden, ordentlich zu bezahlen und Arbeitsbedingungen zu schaffen, bei denen gute Leute bleiben wollen.

0
0
0
1
0
0

Meet the duck-billed tree frog (Triprion spatulatus). Found on Mexicoโ€™s Pacific coast, this species inhabits altitudes of up to 1,640 ft (500 m). Arboreal and primarily nocturnal, it feeds on invertebrates including crickets, grasshoppers, and spiders.

Photo: Cheryl Harleston Lรณpez Espino (magazhu), CC BY-NC-ND 4.0, iNaturalist

via amnhnyc


Image Description
A photo of a duck-billed tree frog perched on a human hand. The amphibian is green in color with dark patterning and a pale white underbelly. 

Scientists have observed this critter using its shovel-like head to plug the openings of its burrows, guarding itself while it rests inside, which is why itโ€™s also known as the shovel-headed tree frog.
0
1
1

Defer available in gcc and clang

About a year ago I posted about defer and that it would be available for everyone using gcc and/or clang soon. So it is probably time for an update.

Two things have happened in the mean time:

  • A technical specification (TS 25755) edited by JeanHeyd Meneide is now complete and moves through ISOโ€™s complicated publication procedures.
  • Both gcc and clang communities have worked on integrating this feature into their C implementations.

I have not yet got my hands on the gcc implementation (but this is also less urgent, see below), but I have been able to use clangโ€™s which is available starting with clang-22.

I think that with this in mind everybody developing in C could and should now seriously consider switching to defer for their cleanup handling:

  • no more resource leakage or blocked mutexes on rarely used code paths,
  • no more spaghetti code just to cover all possibilities for preliminary exits from functions.

I am not sure if the compiler people are also planning back ports of these features, but with some simple work around and slightly reduced grammar for the defer feature this works for me from gcc-9 onward and for clang-22 onward:

#if __has_include(<stddefer.h>)
# include <stddefer.h>
# if defined(__clang__)
#  if __is_identifier(_Defer)
#   error "clang may need the option -fdefer-ts for the _Defer feature"
#  endif
# endif
#elif __GNUC__ > 8
# define defer _Defer
# define _Defer      _Defer_A(__COUNTER__)
# define _Defer_A(N) _Defer_B(N)
# define _Defer_B(N) _Defer_C(_Defer_func_ ## N, _Defer_var_ ## N)
# define _Defer_C(F, V)                                                 \
  auto void F(int*);                                                    \
  __attribute__((__cleanup__(F), __deprecated__, __unused__))           \
     int V;                                                             \
  __attribute__((__always_inline__, __deprecated__, __unused__))        \
    inline auto void F(__attribute__((__unused__)) int*V)
#else
# error "The _Defer feature seems not available"
#endif

So this is already a large panel of compilers. Obviously it depends on your admissible compile platforms whether or not these are sufficient for you. In any case, with these you may compile for a very wide set of installs since defer does not need any specific software infrastructure or library once the code is compiled.

As already discussed many times, the gcc fallback uses the so-called โ€œnested functionโ€ feature which is always subject of intense debate and even flame wars. Donโ€™t worry, the implementation as presented here, even when compiled with no optimization at all, does not produce any hidden function in the executable, and in particular there is no โ€œtrampolineโ€ or whatever that would put your execution at risk of a stack exploit.

You may also notice that there is no fallback for older clang version. This is because their so-called โ€œblocksโ€ extension cannot easily be used as a drop-in to replace nested function: their semantics to access variables from the surrounding scope are different and not compatible with the defer feature as defined by TS 25755.

So for example if you are scared of using big VLA on the stack, you may use the above code in headers and something like

double* BigArray
  = malloc(sizeof(double[aLot]));
if (!BigArray {
  exit(EXIT_FALURE);
}
defer { 
  free(BigArray); 
}

to have an implementation of a big array with a failure mode for the allocation.

Or if you want to be sure that all your mutexes are unlocked when you leave a critical section, use and idiom as here

{
  if (mtx_lock(&mtx) != thrd_success) {
    exit(EXIT_FAILURE);
  }
  defer {
    mtx_unlock(&mtx);
  }

  ... do something complicated ...

  if (rareCondition) {
    return 42;
  }

  ... do something even more complicated ...
}

Just notice, that youโ€™d always have to use the defer feature with curly braces to ensure that the gcc fallback works smoothly.

0

๐“ฒเฎฃ๐ŸŒ€

โ†’้€ใ้€šใฃใŸใ‚คใ‚ซใŒๆดพๆ‰‹ใชๆจกๆง˜ใ‚’ๆผ”ๅ‡บใ€€็†็”ฑใฏๆฑ‚ๆ„›ใ€€ๆฑๅคงใชใฉ็™บ่ฆ‹
mainichi.jp/articles/20260214/

0
0
0
0
0
0
0
1
0
1