2012/2/16 Jim Michaels <[email protected]>
>
> I have heard of stdint.h but not inttypes.h
> I just looked at one on a linux system, PRIdu4 does not seem to be
> cross-platform. there IS a PRId64.
> I looked it up, and I think I need to switch my way of using printf on
> cross-platform. however, size_t is an icky one, because DJGPP does not
> support size_t in printf. it is the one compiler that throws a monkey
> wrench into the entire works.
>
> I just found out that on 64-bit systems, size_t and size_type are 64-bit.
> on 32-bit systems they are 32-bit. this leaves me with #ifdef-ing my way
> through a lot of my code. I would much rather be using some sort of macro
> that can change its bit width depending on 32 or 64-bit at compile time, or
> use some *standard* cout and printf ways of displaying size_t and size_type!
>
Uh, well, if you're willing to switch to std::cout, no format specifiers
needed. If not, just cast to the largest unsigned integer type, which
should be unsigned long long, but this unfortunately has no cross-platform
format string (in msvcrt80+ I believe the standard %llu is supported).
Heck, you could knock in a call to lltoa and print the string returned from
that, but I really suggest <iostream>.
Ruben
>
> changeable data types make cross-platform coding a headache, as I am sure
> you are well aware.
> I would prefer some sort of standard OR some way I can standardize a way
> of doing this. I think I have a way, I am making my own standard, a
> quprintf.h file which has some #defines for STPRINTFD, STPRINTFU,
> SZTPRINTFD, SZTPRINTFU.
>
> too bad the standard says that the definition in any particular compiler
> of size_t should not be relied upon.
>
> ------------------------------
> *From:* JonY <[email protected]>
> *To:* [email protected]
> *Sent:* Friday, February 10, 2012 1:03 AM
> *Subject:* Re: [Mingw-w64-public] sizeof(size_t) on 64-bit systems with
> auto build?
>
> On 2/10/2012 08:24, Jim Michaels wrote:
> > is PRIdu4 some sort of built-in macro?
> >
> >
> >
> > I will probably use the %Iu since it works with either platform and most
> implementations use size_t for their definitions of size_type (but not
> everything is in g++!).
> > I tried
> > find . -exec egrep "typedef[ \t].*[ \t]size_type;" {} ; -print
> > and got some very interesting answers...
> >
>
> Hi,
>
> %Iu isn't very useful outside of Windows.
>
> I'm surprised you have not heard of stdint.h and inttypes.h, yes, they
> are part of the C99 macros, simply include inttypes.h and stdint.h to
> make it work.
>
> Starting with MSVC 2010, MS has provided stdint.h, but not inttypes.h,
> see <https://code.google.com/p/msinttypes/> for msvc versions.
>
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public