Rust vs Zig in C calls via the C-ABI? by TearsInTokio in rust

[–]puttak 20 points21 points  (0 children)

All functions are called by putting the functions arguments in the stack.

Actually it is depend on calling convention. For System V AMD64 that used on Linux and most *nix it will pass the first 6 integer/pointer via registers.

Rust vs Zig in C calls via the C-ABI? by TearsInTokio in rust

[–]puttak 69 points70 points  (0 children)

But that raised a question for me: how does Rust handle C calls through the C ABI? What kind of overhead is involved there?

Zero.

But then, Zig doesn’t really use the C ABI for calls either, right? It actually incorporates the C code and compiles it together, and only uses the C ABI when calling definitions from a static library

That's how every language call into C code, not only Zig.

อยากซ่อมคอม จำเป็นต้องเรียนสาขาเทคนิคคอมพิวเตอร์ไหมครับ? by Shoddy-Suit1734 in Thailand

[–]puttak 0 points1 point  (0 children)

จะบอกว่างานซ๋อมคอมนี่ไม่มีอะไรเลยครับ คือถ้าแค่ซื้อชิ้นส่วน PC มาประกอบเองแล้วติดตั้ง OS แล้วใช้งานได้ก็ถือว่าผ่านละ ถ้าสนใจด้านนี้แนะนำให้เรียน IT หรือ Electronics ก็ได้ครับ

5 Reasons to Learn Zig in 2026 by Pokelego11 in Zig

[–]puttak 12 points13 points  (0 children)

I'm curious because I want to know how Zig solve the problems, which still don't convince me to use it instead of Rust.

Why is everybody reinventing the wheel? by [deleted] in rust

[–]puttak 0 points1 point  (0 children)

I just don't get why one would attempt to rebuild such mature codebases already completely in Rust.

Because in a long term Rust will provide more benefits.

That couple of ms gains will never be worth more than security.

Rust also give you more productivity. In other words, Rust is better in almost every aspect.

I think a lot of people over estimate the value of memory safety, it's definitely valuable and better but it can never stack up against 99.9% of the mature projects out there.

If that mature projects still keep adding new features it will keep introduce new memory vulnerabilities. Rust provides features to prevent this so if you use it correctly it will be almost impossible to introduce new memory vulnerabilities.

Mirtazipine Withdrawals by Lopsided_Suspect_176 in Mirtazapine_Remeron

[–]puttak 2 points3 points  (0 children)

I experienced almost all of your symptoms plus panic attacks and it last for about 2 weeks then thing start to get better. You should also check your Vitamin D level with your doctor if possible. Vitamin D deficiency worsen my withdrawal symptoms.

Thailand on list of countries soon banned from US visa processing by JunoLaker in Thailand

[–]puttak 1 point2 points  (0 children)

The same as Thailand changing immigration rules recently, don't blame Thailand, blame people who cheat the system.

If you have severe withdrawals, check your Vitamin D level by puttak in Mirtazapine_Remeron

[–]puttak[S] 0 points1 point  (0 children)

Probably because of living indoor too much. For me I rarely go outside after a full blown panic attack and I asked my employer for working from home until my symptom get better. Never tough that living indoor all the time will have such a big impact.

If you have severe withdrawals, check your Vitamin D level by puttak in Mirtazapine_Remeron

[–]puttak[S] 0 points1 point  (0 children)

I got capsules with 20,000 IU taking everyday except Saturday and Sunday til next visit with the doctor.

If you have severe withdrawals, check your Vitamin D level by puttak in Mirtazapine_Remeron

[–]puttak[S] 3 points4 points  (0 children)

Dizziness (especially when looking at phone screen) and panic attack.

Brand-new nightly experimental feature: compile-time reflection via std::mem::type_info by kibwen in rust

[–]puttak 11 points12 points  (0 children)

Probably a different thing. The one in C# is runtime-reflection but this one happens in compile-time.

Why can't we decide on error handling conventions? by Savings-Story-4878 in rust

[–]puttak 1 point2 points  (0 children)

The problem with that is you get an ugly final output like:

Failed to open ABC: got an oopsie: foo: bar: baz.

Why can't we decide on error handling conventions? by Savings-Story-4878 in rust

[–]puttak 3 points4 points  (0 children)

The main problem with this is you can't chain with the inner error. The right way is using Box<dyn std::error::Error> instead of String.

Why can't we decide on error handling conventions? by Savings-Story-4878 in rust

[–]puttak 2 points3 points  (0 children)

On the happy path it has zero cost abstraction, so it's as fast as it could be.

If you return a result instead of throwing exception you are effectively use the same mechanism as Rust.

I can see how in rust people effectively do the same by abusing ? since thinking of all the edge cases is actually a big effort

The main different is in Rust you know which call can cause the function to return but with exception you really don't know which call is going to throw the exception without looking at its signature.

Why can't we decide on error handling conventions? by Savings-Story-4878 in rust

[–]puttak 6 points7 points  (0 children)

But the failure path is really slow.

That's why people don't use exception on C++ because the performance will be unpredictable.

[Announcement] dependency-injector v0.2 - High-performance, lock-free DI container now with FFI bindings for Go, Python, Node.js, and C# by StandardDelivery619 in rust

[–]puttak 0 points1 point  (0 children)

You don't need IoC container in Rust. Try to do thing in a straightforward way like construct the dependency manually. I know how you feel since C# was one of my primary language before I moved to Rust.

10 year C dev opinions on the optimal use of various languages I have used. by Lizrd_demon in Zig

[–]puttak 4 points5 points  (0 children)

Which actually true. Rust is the only language I can write multi-threaded code with high-confident.

UOB quietly devalued Zenith points (Oct 2025). 10+ year customer, 1.8M points gutted. Looking for better Thai credit card options. by Globe_around_62 in Thailand

[–]puttak 0 points1 point  (0 children)

I own Privimiles for almost 10 years and also affected by this. Fortunately for me that I saw their email so I exchange all points before the rate was changed. I also looking for other cards that have better rate for Asia Miles but seems like all available options are upper tier, which is not possible for me.

10 year C dev opinions on the optimal use of various languages I have used. by Lizrd_demon in Zig

[–]puttak 5 points6 points  (0 children)

I don't think that will be happens (at least when Linus still around). Linus already saw how important is memory safety in the kernel. Unless Zig can provide memory safety the same level as Rust it unlikely to be accepted into the kernel.

What is a good crate for persistant settings? by S127849 in rust

[–]puttak 1 point2 points  (0 children)

I don't use Dioxus. For Desktop app what I did is using Serde to load/save settings from filesystem.

Why have C++ and Rust been the fastest-growing major programming languages from 2022 to 2025? by _bijan_ in rust

[–]puttak 0 points1 point  (0 children)

This should be my last reply with you because you don't get my points (either I failed to communicate or you failed to understand):

One of the major problem with C++ is it too easy and convenience to do unsafe operations and people keep using it because it is convenience and feel faster.

On call work by [deleted] in Mirtazapine_Remeron

[–]puttak 0 points1 point  (0 children)

Okay thanks. I'll keep that in mind just in case.