Discussion:
[9fans] Unexpected complaint
(too old to reply)
l***@proxima.alt.za
2013-04-02 06:54:21 UTC
Permalink
The following code triggers a warning:

#include <u.h>
#include <libc.h>

int main() {
unsigned long long val = 0;

print("VAL: %llu\n", val);
return 0;
}

warning: llu.c:7 format mismatch llu
UVLONG, arg 2

and produces the damnedest output:

VAL: %
%(not terminated by a newline).

Something's not right, anybody know what the cause is? And maybe the
cure?

++L
Yaroslav
2013-04-02 07:02:31 UTC
Permalink
works as expected if given "%llud" format.
Post by l***@proxima.alt.za
#include <u.h>
#include <libc.h>
int main() {
unsigned long long val = 0;
print("VAL: %llu\n", val);
return 0;
}
warning: llu.c:7 format mismatch llu
UVLONG, arg 2
VAL: %
%(not terminated by a newline).
Something's not right, anybody know what the cause is? And maybe the
cure?
++L
--
- Yaroslav
l***@proxima.alt.za
2013-04-02 07:27:44 UTC
Permalink
Post by Yaroslav
works as expected if given "%llud" format.
I thought I'd tried that (in another context) and the results were
even more disappointing. I'll have to re-read the printf(2) man
page...

Thanks.

++L
Charles Forsyth
2013-04-02 08:15:11 UTC
Permalink
Post by l***@proxima.alt.za
I'll have to re-read the printf(2) man
you're using print, not printf, and the conventions are different.
l***@proxima.alt.za
2013-04-02 08:18:50 UTC
Permalink
Post by Charles Forsyth
you're using print, not printf, and the conventions are different.
I thought I wasn't totally insane! Thank you, Charles.

++L

PS: Now I got to go back to the original instance of the problem and
figure out what is the case there,

Continue reading on narkive:
Loading...