gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] Problem with printf


From: Gaius Mulley
Subject: Re: [Gm2] Problem with printf
Date: 19 Nov 2007 16:06:48 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

"Dmitry Shatrov" <address@hidden> writes:

> On Nov 19, 2007 5:25 PM, Dmitry Shatrov <address@hidden> wrote:
> > Hello,
> >
> > I'm experiencing weird behavior when passing parameters to printf().
> > If I read gm2 docs ( http://www.nongnu.org/gm2/gm2.html ) correctly, my
> > code should work, because it is just like in an example from chapter
> > 1.9.
> >
> > Here's the test case. The following program should print "ABC 1 2 3",
> > but what I get is "ABC 1 0 2". I'm using fresh gm2 from CVS.
> 
> My fault, sorry. The following works fine:
> 
> MODULE test;
> 
> FROM SYSTEM IMPORT ADR;
> FROM libc IMPORT printf;
> 
> PROCEDURE Test (str : ARRAY OF CHAR);
> VAR
>     r : INTEGER;
> BEGIN
>     r := printf ("%s %u %u %u\n", ADR (str),
>                  CARDINAL (1), CARDINAL (2), CARDINAL (3));
> END Test;
> 
> BEGIN
>     Test ("ABC");
> 
> END test.
> 
> 
> Wbr,
> Dmitry

Hi Dmitry,

no problem - thanks for the email - looks like to documentation should
make clear one needs to cast constants when they are being passed
a procedure with vararg parameters,

regards,
Gaius




reply via email to

[Prev in Thread] Current Thread [Next in Thread]