Frama-C-discuss mailing list archives
This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Frama-c-discuss] Problem with werify mod 256 and cast to uint8 equivalence for uint64_t
- Subject: [Frama-c-discuss] Problem with werify mod 256 and cast to uint8 equivalence for uint64_t
- From: sztfg at yandex.ru (sztfg at yandex.ru)
- Date: Tue, 22 Mar 2016 12:08:55 +0300
- In-reply-to: <20160321193013.GA43632@thinkpad.swarthmore.edu>
- References: <845751458525473@web1m.yandex.ru> <56EF90CA.4040204@gmail.com> <20160321193013.GA43632@thinkpad.swarthmore.edu>
> Â Â I was going to go into language lawyer mode and point out that a char is specified to be one byte, but a byte isn't specified to 8 bits. Yes, CHAR_BIT can be 8 or greater ... but I use uint8_t cast in my code. Look at "7.20.1.1 Exact-width integer types" > Â Â The typedef name uintN_t designates an unsigned integer type with width N and no padding bits. Thus, uint24_t denotes such an unsigned integer type with a width of exactly 24 bits. Macro CHAR_BIT from limits.h defines the number of bits in a char. Frama-C in it's internal "stdint.h" : typedef unsigned char uint8_t; typedef unsigned long long uint64_t; typedef long long intmax_t; assumes that "unsigned char" and "uint8_t" is the same thing, but this wrong for some platform/compilers. On come platform, "char" type can be "unsigned char" -> "5.2.4.2.1 Sizes of integer types <limits.h>" https://www.lysator.liu.se/c/rat/c1.html#3-1-2-5 : > Â Â Three types of char are specified: signed, plain, and unsigned. A plain char may be represented as either signed or unsigned, depending upon the implementation, as in prior practice. The type signed char was introduced to make available a one-byte signed integer type on those systems which implement plain char as unsigned. For reasons of symmetry, the keyword signed is allowed as part of the type name of other integral types. Signed integers can be one's complement or twoâs complement "6.2.6.2 Integer types" -> https://en.wikipedia.org/wiki/Signed_number_representations
- References:
- [Frama-c-discuss] Problem with werify mod 256 and cast to uint8 equivalence for uint64_t
- From: sztfg at yandex.ru (sztfg at yandex.ru)
- [Frama-c-discuss] Problem with werify mod 256 and cast to uint8 equivalence for uint64_t
- From: iguer.pro at gmail.com (Mohamed Iguernlala)
- [Frama-c-discuss] Problem with werify mod 256 and cast to uint8 equivalence for uint64_t
- From: mmcco at mykolab.com (Michael McConville)
- [Frama-c-discuss] Problem with werify mod 256 and cast to uint8 equivalence for uint64_t
- Prev by Date: [Frama-c-discuss] Problem with werify mod 256 and cast to uint8 equivalence for uint64_t
- Next by Date: [Frama-c-discuss] invitation to try an alpha release of an Eclipse GUI for Frama-C
- Previous by thread: [Frama-c-discuss] Problem with werify mod 256 and cast to uint8 equivalence for uint64_t
- Next by thread: [Frama-c-discuss] invitation to try an alpha release of an Eclipse GUI for Frama-C
- Index(es):