Re: [EXTERNAL]: Re: Why int32_t is long int on 32 Bit Intel?

Stefan Tauner <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Sat, 29 Jul 2023 08:47:22 -0400
Trampas Stern <[email protected]> wrote:

> Most code and libraries, like FAT libraries, all assume a char is 8bit.

Well, it's mandated by POSIX to be 8 bits and in general a quite
reasonable assumption (if targeting POSIX systems) but not necessarily
true elsewhere... and if you depend on the signedness of char you are
doing it wrong too. If you want 8 unsigned bits you should use uint8_t
instead of char. In that regard it's quite similar to the int
"problem". In either case there is a proper solution in C that is
working on all conforming systems.

> right shift sign extended.

Right shifts of negative integers is UB in C (and not necessarily
sign-extended) if that's what you mean. We are also quite off-topic
already IMHO...

-- 
Kind regards/Mit freundlichen Grüßen, Stefan Tauner
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.