Get the latest tech news

Want to Unlock Performance and Clarity? Use Strong Types


! Christian Eltzschig - 01/06/2024 cpp rust clean-code performance C++ and Rust are strongly typed languages, meaning whenever you declare a variable, you must either explicitly specify the variable or you do it implicitly by assigning a value of a specific type. The type of the variable also comes with a specific contract.

When defining a function input argument as uint32_t, we never need to verify that the user accidentally gave us a negative number or a string. This method returns an optional value that contains either a valid UserName object or nothing when the user name contract is violated. Because whenever one has a call chain where those arguments are forwarded to other functions, especially when they are not directly under your control, the same semantical verification has to be performed.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Performance

Performance

Photo of clarity

clarity

Photo of strong types

strong types

Related news:

News photo

TSMC: Performance and Yields of 2nm on Track, Mass Production To Start In 2025

News photo

Ubuntu 24.04 + Linux 6.9 Intel & AMD Server Performance

News photo

AMD EPYC 4004 Benchmarks: Outperforming Intel Xeon E-2400 With Performance, Efficiency & Value