[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scp.c compile warnings


On Tuesday 18 August 2009 16:33:07 Aris Adamantiadis wrote:
> Keisial a écrit :
> > Jean-Philippe Garcia Ballester wrote:
> >>> The first one can be fixed by #include <stdio.h>, but I am not sure
> >>> about a portable way to fix the second one. Maybe just cast to (long
> >>> int)?
> >>
> >>   Isn't %zd portable ?
> >
> > I don't think %zd would work on Windows.
> 
> We can "fix" that with a big (unsigned long long) cast like Andreas did
> for the other type issue :)
> 

#ifdef MSVC
#define PRIdS "Id"
#else
#define PRIdS "zd"
#endif

printf("size is %" PRIdS ".\n", (size_t) 5);

inttypes.h defines this for integers. to print uint64_t you use normally

printf("value is %" PRIu64 ".\n", (uint64_t) 5);


	-- andreas

Attachment: signature.asc
Description: This is a digitally signed message part.


References:
scp.c compile warningsVic Lee <llyzs@xxxxxxx>
Re: scp.c compile warningsKeisial <keisial@xxxxxxxxx>
Re: scp.c compile warningsAris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org