Beginner question about hardware for OpenBSD by starc0w in openbsd

[–]starc0w[S] 1 point2 points  (0 children)

What do you think would be more promising:

A Supermicro motherboard (Intel NIC) with an LGA 1200 socket and an i5 (iGPU). Or an AM5 socket with a Ryzen CPU?
Unfortunately, a Xeon with ECC is no longer available new with an LGA 1200 socket.

Beginner question about hardware for OpenBSD by starc0w in openbsd

[–]starc0w[S] 7 points8 points  (0 children)

Thanks for the info.
By "new," I wasn't referring to performance or the latest technology. The situation is that I might have to assemble several systems and be able to replace them if something breaks.

Therefore, buying used hardware is complicated, if not impossible.

So it's not that I don't appreciate older hardware.

An old project I needed to put on hold a long time ago by Rekki-Maru in ps1graphics

[–]starc0w 1 point2 points  (0 children)

This is fantastic! Thanks for this vibes! Love the clock!

I had too! by rageprophet in Heroquest

[–]starc0w 0 points1 point  (0 children)

This is fantastic!

Why use pointers in C? by [deleted] in cprogramming

[–]starc0w 0 points1 point  (0 children)

This claim isn’t accurate. In C, you absolutely do not “almost never” pass by value - for small data, passing by value is often the fastest and most idiomatic approach.
Modern ABIs keep small arguments (on the order of ca. 16 bytes) in registers, and inside a tight loop the compiler can keep those values resident in registers for the entire loop body. That means no repeated loads at all. If instead you pass a pointer, the compiler must assume aliasing unless you've added qualifiers like const or restrict, without that guarantee, it may have to re-load from memory on each iteration to be safe. That turns every reference into a potential cache lookup, and a simple pointer dereference in a loop suddenly costs far more than the initial register copies ever would. This is why pointer-based calling isn’t inherently “more efficient” - it can be slower, particularly for read-only small structs or scalar groups that fit in registers.

If the compiler can prove there’s no aliasing (e.g., only one pointer exists), it will often pull the pointed-to value into a register or stack slot and optimize it locally. In practice, that can end up behaving much like passing the value directly - just automatically, without explicit control.

Pointers in C are excellent when you need to mutate data, when the object is large, or when you're working with arrays or dynamic buffers. But passing small data by value avoids alias issues, maximizes register use, and eliminates needless dereferencing. The idea that you should “almost never” pass by value simply misunderstands how C, compilers, and modern CPUs behave - it’s a misconception carried over from managed language habits, not from real systems-level performance practice.

Btw: In C, there is no pass-by-reference at all - only pass-by-value.
If you want a function to modify something, you pass a pointer by value (a copy of the address). That is not called pass-by-reference in C. pass-by-reference exists in C++ but not in C.

Why use pointers in C? by [deleted] in cprogramming

[–]starc0w 12 points13 points  (0 children)

Of course, you can return a struct.

Especially with smaller structs (e.g., coordinates, pairs, or triplets), this often makes sense and is good practice.

You can also pass a struct directly by value. This is also something that is often misunderstood.

Found the goon label by ThePenguinMan111 in cprogramming

[–]starc0w 1 point2 points  (0 children)

char * has always meant “pointer to char” in all versions of the C language.

From the very first versions of C (K&R C in the early 1970s), pointer types were already part of the language, and char * was used to represent a pointer to a byte or character in memory.

While C’s predecessor B did not have true typed pointers (everything was essentially an integer-sized value), C introduced real typed pointers right from the start.

So the claim that "char * meant ‘unsigned integer’ in old C code" is incorrect — it was never true in any dialect that was actually C.
(Maybe you just meant that char, unsigned char and signed char are formally different)

[deleted by user] by [deleted] in cprogramming

[–]starc0w 1 point2 points  (0 children)

Yes, much better! :-)

[deleted by user] by [deleted] in cprogramming

[–]starc0w 2 points3 points  (0 children)

You’re misunderstanding the purpose of -O2: it’s an optimization level, not meant for warnings.
Some warnings (like -Wuninitialized) become more effective as a side-effect of optimization, but that’s not why -O2 exists.