Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
debate: char vs. byte
takeshimiya:
Ok, but the problem started because the keyword char is not clear if it's a byte or a character. :)
--- Quote from: me22 on August 23, 2005, 09:25:44 pm ---Sorry, but neither of those are ISO C++ standard headers.
--- End quote ---
Sorry, but they ARE from the ISO C++/C99 Standard library headers.
The fact they come with boost (or some other libraries) is to add support for compilers of the pre-standard era.
From http://en.wikipedia.org/wiki/Standard_C_library
<inttypes.h>: For precise conversion between integer types. (New with C99)
http://www.opengroup.org/onlinepubs/009695399/basedefs/inttypes.h.html
http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf
I have the official book from the C/C++ standard and including <inttypes.h> and <stdtypes.h> in the C++ headers it's mandated by C99/C++.
If you don't have the book, just google for inttypes.h and you'll see.
---
--- Quote from: tiwag on August 23, 2005, 10:19:01 pm ---everywhere in the world, since microcontrollers have been developed,
byte's and word's are unsigned and only reflect the size of 8 and 16 bits respectively.
--- End quote ---
everywhere in the world, since microcontrollers have been developed,
used ASCII, and now there is a standard called UNICODE...
The u for unsigned became rather standard for typedef's of unsigned.
It's not what you like or not, you must support the standards (if not, I'll be calling you MS IE :lol:)
Sorry for being a little off-topic, but most of the character (UNICODE) problems are arised by not following the convention/standards.
me22:
--- Quote ---The header <boost/cstdint.hpp> provides the typedef's useful for writing portable code that requires certain integer widths. All typedef's are in namespace boost.
The specifications are based on the ISO/IEC 9899:1999 C Language standard header <stdint.h>. The 64-bit types required by the C standard are not required in the boost header, and may not be supplied in all implementations, because long long is not [yet] included in the C++ standard.
--- End quote ---
from http://boost.org/libs/integer/cstdint.htm
ISO C++ : 1998 has normative references to C89, but NOT to C99.
And there's no "official book from the C/C++ standard". C/C++ doesn't exist. I don't have a copy of the ISO C++ : 1998 standard myself, but I do have Bjarne's The C++ Programming Language Special Edition which never mentions <stdint.h> or <stdtypes.h> or <inttypes.h>. Also, if they /were/ in the standard, they'd either be accessable through <cstdint> or <stdint>, to follow the C++ Standard naming conventions.
takeshimiya:
--- Quote from: me22 on August 24, 2005, 03:26:33 am ---ISO C++ : 1998 has normative references to C89, but NOT to C99.
--- End quote ---
In reality it's mandatory in C89, and in C99 also. (Some things have been updated in C99 too).
The next revision of C++ will have almost all of C99.
--- Quote ---And there's no "official book from the C/C++ standard". C/C++ doesn't exist. I don't have a copy of the ISO C++ : 1998 standard myself, but I do have Bjarne's The C++ Programming Language Special Edition which never mentions <stdint.h> or <stdtypes.h> or <inttypes.h>.
--- End quote ---
http://www.google.com/url?sa=t&ct=res&cd=1&url=http%3A//www.nirvani.net/docs/ansi_c.pdf&ei=1d4LQ5u4G8DKaKbnrLcI&sig2=b17IrTzIgaM11IcxBzFYyQ
http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=29237
--- Quote ---Also, if they /were/ in the standard, they'd either be accessable through <cstdint> or <stdint>, to follow the C++ Standard naming conventions.
--- End quote ---
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1568.htm
Header *<cinttypes>*
Anyways, for writting portable code right now, just use <inttypes.h> from whatever you want (boost, gcc, stlport, your own header, etc).
Well, better to open a new thread if anyone wants to discuss more about this topic (if not, rickg22 will get mad :P)
me22:
--- Quote from: takeshimiya on August 24, 2005, 06:34:23 am ---http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=29237
--- End quote ---
If you have it, can you tell me the section number where it's referenced?
--- Quote from: takeshimiya on August 24, 2005, 06:34:23 am ---
--- Quote ---Also, if they /were/ in the standard, they'd either be accessable through <cstdint> or <stdint>, to follow the C++ Standard naming conventions.
--- End quote ---
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1568.htm
Header *<cinttypes>*
--- End quote ---
uhh... if you look at the top of that document you'll see:
PROPOSED ADDITIONS TO TR-1 TO IMPROVE
COMPATIBILITY WITH C99
And that paper is NOT one of the ones accepted into tr1.
takeshimiya:
Thanks for moving the thread :)
Yes, it's on chapter 7. Library - 7.8 Format conversion of integer types <inttypes.h>
on page 211/554 of the PDF, page 197 of the book.
It's on the C99 Standard but not in the current C++ ISO Standard, and that's why it's very probable it will be in the next revision.
It doesn't sounds very good C being more updated than C++, doesn't it?
Anyways, to make code future-proof and portable, you can include <inttypes.h> right now.
I don't think it would do any harm to not having <cinttypes> right now.
It's not likely you would need to use the std namespace only for some typedef int int32_t; right?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version