in reply to Re^11: odd line in windows
in thread odd line in windows

Here's an alternative way of writing the function that might be clearer.

SV* new(const char * classname, const char * name, const char * rank, +long serial) { Soldier * soldier; SV * obj; SV * obj_ref; New(42, soldier, 1, Soldier); soldier->name = savepv(name); soldier->rank = savepv(rank); soldier->serial = serial; obj = newSViv((IV)soldier); obj_ref = newRV_noinc(obj); sv_bless(obj_ref, gv_stashpv(classname, GV_ADD)); SvREADONLY_on(obj); return obj_ref; // Inline will mortalize. }

Replies are listed 'Best First'.
Re^13: odd line in windows
by BrowserUk (Patriarch) on Sep 08, 2011 at 23:15 UTC

    Indeed. That is much clearer.

    syphilis if you are following along, it would be worth updating the POD with that example


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      syphilis if you are following along, it would be worth updating the POD with that example

      Done in the git version.

      Cheers,
      Rob