While prepending the + seems a bit pointless, that's what + does in
sprintf.  You don't need to add it to get a "signed" binary number:


sprintf() seems to switch to signed mode automatically when a negative number is presented, which is clever but to me seems fundamentally flawed, if you're trying to interchange data. You certainly don't want a field to be encoded one way for certain situations but another way the rest of the time. There doesn't appear to be a way to force unsigned encoding, which makes things difficult when trying to pack data, right?


array_sscanf(sprintf("%-4c", -65335), "%-+4c");
(2) Result: ({ /* 1 element */
               -65335
           })


  • pos... H. William Welliver III
    • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
      • ... Bill Welliver
        • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
          • ... Bill Welliver
            • ... Mirar @ Pike developers forum
              • ... Bill Welliver
                • ... Mirar @ Pike developers forum
                • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
                • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
        • ... Mirar @ Pike developers forum
          • ... Bill Welliver
            • ... Henrik Grubbstr�m (Lysator) @ Pike (-) developers forum
              • ... Bill Welliver
                • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum

Reply via email to