Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8082

C/C++ • Re: Best way to determine "bitted-ness" from a running program?

$
0
0
Since the OP already has a working solution it's pretty clear they know exactly what they want.
The OP presented a way how to determine some value by evaluating " sizeof(void *) * CHAR_BIT" and asked how to do it in best way without explaining what is the reason for this exercise and what will the value tell him. He also defined very vague term ""bitted-ness" with very vague definition as "running 32 bit or 64 bit"

The rest is just one misunderstanding after another with random people guessing and suggesting random things or asking for more details and OP changing goalposts and providing none or very vague or contradicting answers.

Also the topic name "Best way to determine "bitted-ness" from a running program?". If the real question is "How to determine pointer size in bits in my C code?" then over 90% of what OP wrote is unrelated - like talking about running a program, sizeof(long), talking about various OSes.

size of C pointer can tell you how big array you can address in theory by dereferencing the pointer in your code but that's about all. it won't tell you anything about size of other types or whether the OS is 32 or 64 bit (the "getconf LONG_BIT" suggestion) or whether the kernel running the (possibly 32bit) OS is 64bit.
Since the OP already has a working solution it's pretty clear they know exactly what they want.
I think many times "OP already has a working solution" does not at all imply "they know exactly what they want".
Lighten up a bit !
Good point :-)

Statistics: Posted by fanoush — Thu Oct 23, 2025 1:03 pm



Viewing all articles
Browse latest Browse all 8082

Trending Articles