AW: Am I checking for undef in the wrong way?

[email protected] ("Bolhar-Nordenkampf Ferdinand")
Newsgroups perl.xs
Message-ID <D960CB61B694CF459DCFB4B0128514C203A2E881@exadv11.host.magwien.gv.at>
> Thus, in any place where I receive a value of which I don't know the
> origin, I should call SvGETMAGIC first. I could then just as well 
> have
> 
>   BOOL sv_isdefined(SV *sv) {
>      SvGETMAGIC(sv);
>      return SvOK(sv);
>   }
> 
> Or would this lead in my new problems?
> 
> Thanks a lot for your quick answer!

If a scalar has a type of MAGIC:

(SvTYPE(sv) == SVt_PVMG) and 

has the SVs_GMG flag set in its SvFLAGS field:

((SvFLAGS(sv) & SVs_GMG)

you should invoke SvGETMAGIC. Otherwise, it isn't required.

Greetings, Ferry
--

Ing. Ferry Bolhár-Nordenkampf
Magistrat der Stadt Wien - MA 14
A-1010 Wien
E-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.