Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++ Subject: Re: [QT creator on "nix"] - getting a strict 8 bit (1 byte) array with no padding Date: Wed, 20 Nov 2019 22:43:45 -0800 Organization: None to speak of Lines: 31 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="24eb7375dfea9bd4e6060ce0ed84a202"; logging-data="23093"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sWTGXg7JKRsKVQuuP0wEQ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:sQlkcBIlBQLisJ/AYQU2y3gC4h0= sha1:GR3U6f+jnkdZH7gzgqczeh3vMio= Xref: csiph.com comp.lang.c++:69949 Keith Thompson writes: > Soviet_Mario writes: >> I am trying to create a statically linked library in the >> said IDE. >> I would not want to include many QT features for now >> so, what is the STANDARD C++ way to get >> unsigned 8 bits integer type ? > > If uint8_t exists, then both it and unsigned char are unsigned 8-bit > integer types (and very likely uint8_t is an alias for unsigned char). > Using uint8_t makes it more explicit that you want an unsigned 8-bit > integer type. > > If uint8_t doesn't exist, then CHAR_BIT > 8 and there is no 8-bit > integer type. You're unlikely to encounter such an implementation > (I've only heard of very old systems and DSPs) -- and I'd be > astonished if such a system were able to support Qt. [...] I'm curious about something. Do you have a realistic expectation that your code might need to work under an implementation with CHAR_BIT > 8? Do you have such a target system in mind? C++ with the assumption that CHAR_BIT==8 is realistically at least 99% as portable as C++ without that assumption -- and far more portable than C++ with the assumption that Qt is available. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */