1170
Tell me the truth ... (lemmynsfw.com)
submitted 2 months ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 0 points 2 months ago

Sorry, but you're very confused here.

[-] [email protected] 0 points 2 months ago

You said you can't read one byte. I showed that you can. Where's the confusion?

[-] [email protected] 0 points 2 months ago

Internally it will still read a whole word. Because the CPU cannot read less than a word. And if you read the ARM article you linked, it literally says so.

Thus any compiler worth their salt will align all byte variables to words for faster memory access. Unless you specifically disable such behaviour. So yeah, RTFM :)

[-] [email protected] 0 points 2 months ago

Wrong again. It depends on the CPU. They can absolutely read a single byte and they will do if you're reading from non-idempotent memory.

If you're reading from idempotent memory they won't read a byte or a word. They'll likely read a whole cache line (usually 64 bytes).

And if you read the ARM article you linked, it literally says so.

Where?

Thus any compiler worth their salt will align all byte variables to words for faster memory access.

No they won't because it isn't faster. The CPU will read the whole cache line that contains the byte.

RTFM

Well, I would but no manual says that because it's wrong!

[-] [email protected] 0 points 2 months ago

The fuck are you talking about, kiddo? Read the fucking docs!

this post was submitted on 15 May 2025
1170 points (100.0% liked)

Programmer Humor

25151 readers
1665 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS