Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×

Comment Re:Getters and setters (Score 1) 543

Validation!

class ipaddress {
      private unsigned long address;
      private unsigned long netmask; /* storing length would be easier but hush */

      void setaddress(const long newaddress) {
            address = newaddress;
      }
      void setnetmask(const long newnetmask) { // woah, not all longs are valid netmasks!
          if (validatenetmask(newnetmask) {
                netmask = newnetmask;
          } else { die("invalid netmask!"); }
      }
}

Comment Re:Title not a good start (Score 1) 543

Highlight variable definition with too many variables in a list and copy with 'y'.
Hit q, 1, /, ", ",
Now hit "2x", ";", , P
Hit escape, then "20@1" to run 20 more times.

Voila, you turned "int a, b, c, d, e;" into "int a; int b; int c" etc.

Macro was very simple for sake of Slashdot example. Don't forget you can save all those macros and reuse them in the future.

Slashdot Top Deals

Marriage is the triumph of imagination over intelligence. Second marriage is the triumph of hope over experience.

Working...