Thank you Bertrand, this helps me a lot!

It seems that comparing to zero is a bit tricky. I only get results with

string s; // or string s="lolcat";
_typeof(s) == _typeof(0);

Is there a neater way to do this?

Met vriendelijke groet / With kind regards / mit besten Grüßen,



        
        Coen Schalkwijk
Software Engineer

        [email protected] <mailto:[email protected]>

        [email protected] <mailto:[email protected]>

        +31 (0)35 671 8915



On 13-1-2011 15:21, Bertrand LUPART wrote:
Another problem is that 'string s;' or 'string s=0;' evaluate to 'int' when 
using %t and 'zero_type()' doesn't help either.

Not a problem for pike but for any other language using the generated XML.
As a workaround, have you considered using typeof()/_typeof() ?

----8<----8<----8<----
string s; string t=0; string u=""; string v="foo";
zero_type(s);
(1) Result: 0
zero_type(t);
(2) Result: 0
zero_type(u);
(3) Result: 0
zero_type(v);
(4) Result: 0
typeof(s);
(5) Result: string
typeof(t);
(6) Result: string
typeof(u);
(7) Result: string
typeof(v);
(8) Result: string
_typeof(s);
(9) Result: zero
_typeof(t);
(10) Result: zero
_typeof(u);
(11) Result: string
_typeof(v);
(12) Result: string
---->8---->8---->8----


  • Re:... Arne Goedeke
    • ... Coen Schalkwijk
      • ... Arne Goedeke
        • ... Coen Schalkwijk
          • ... Tobias S. Josefowitz
          • ... Johan Björklund
          • ... H. William Welliver III
          • ... Coen Schalkwijk
          • ... Coen Schalkwijk
          • ... Bertrand LUPART
          • ... Coen Schalkwijk
          • ... Coen Schalkwijk
          • ... Coen Schalkwijk
          • ... Martin Bähr
          • ... Coen Schalkwijk
          • ... Martin Bähr
          • ... Coen Schalkwijk
          • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
          • ... Martin Bähr
  • Re:... Martin Bähr
    • ... Martin Nilsson (Opera Mini - AFK!) @ Pike (-) developers forum

Reply via email to