Re: [Vala] printing int64 value to standard output



On 05/15/12 14:43, Sam Wilson wrote:
On 12-05-15 06:54 AM, pancake wrote:
%lld is not portable. your code will not work on windows.

the portable way is:

void main() {
uint64 ts = 123;
stdout.printf ("%"+uint64.FORMAT_MODIFIER;+"d\n", ts);
}

That just looks horrible... Couldn't Vala just compile %lld into the proper format on each platform?

Sam


i know :) but that's just up to the GLIB library, not the C standard. you can use an const string somewhere like:

const string U64FMTd = "%"+uint64.FORMAT_MODIFIER+"d";

But I agree.. glib should provide a format string modifier for this instead of providing defines for using them.



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