On Tue, Aug 26, 2003 at 03:06:00PM +0200 Mark Overmeer wrote:
> * Tassilo von Parseval (tassilo.parseval@xxxxxxxxxxxxxxxxxxx) [030826 14:48]:
> > if(box==NULL) return XSRETURN_UNDEF;
> > It should be either just
> > if(box==NULL) XSRETURN_UNDEF;
>
> Yeh, and gcc is not complaining. Happily someone is.
VisualC is extremely strict in what it will accept. Initially I hated it
for its outdatedness, but after a while I realized that this is a good
thing. Make it compile on VisualC and chances are good that it will
compile almost anywhere else, too.
> > > Output C.xs(986) : warning C4133: 'function' : incompatible types - from
> > > 'char *' to 'struct _iobuf *'
> > > Output C.xs(986) : warning C4133: 'function' : incompatible types - from
> > > 'struct _iobuf *' to 'const char *'
>
> Above is strange. The prototype of fputs is
> (const char *, FILE *)
> not the reverse.
Hehe, enjoy this. Grepping the headers in the Perl source-tree for fputs
gives:
XSUB.h:# define fputs PerlSIO_fputs
fakesdio.h:#undef fputs
fakesdio.h:#define fputs(s,f) PerlIO_puts(f,s)
iperlsys.h:#define PerlSIO_fputs(f,s)
\iperlsys.h:#define PerlSIO_fputs(f,s) fputs(s,f)
nostdio.h:#undef fputs
nostdio.h:#define fputs(s,f) _CANNOT _fputs_
perl.h:# ifndef fputs
perl.h:# define fputs(sv,fp) fprintf(fp,"%s",sv)
perlsdio.h:#define PerlIO_puts(f,s) PerlSIO_fputs(f,s)
So indeed, arguments somehow swapped somewhere in the #define-hell of
the Perl headers. You are probably best off using PerlIO_puts() (see
perlapio.pod). Also, it might be worth having a look at perlclib.pod
since it explicitely mentions such gotchas. The mantra of it is that you
should avoid more or less anything from the libc and instead use the
wrappers provided by the Perl API.
Interestingly enough, I learnt about perlclib just a few days ago and
didn't know it existed before.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
|