--- Bernhard van Staveren <[EMAIL PROTECTED]> wrote:
> >   band = intmax(strtok(NULL,seps)[0]-64,0);
> 
> I know barely enough C to hang myself with but the above does make
> sense, in a real twisted way :D

lol -- as I said, that was tame. ;0)

> I don't know really, usually the projects I write for myself, or the
> code I write that gets sold to multiple people I try to make as
> "obfuscated" as possible in a way - at least the chances are better
> I'll be the one who gets called on to maintain it ;)
> Gotta promote job longevity somehow.

*grin* a coworker and I kid about writing a script that goes through
all our code removing any comments and replacing ALL whitespace with
single spaces or newlines.
 
> Code that's written for others, or when I get hired as a programmer
> is usually well commented, neatly spaced and if I feel particularly
> good that day I'll run it thru prettyperl just so it looks good and
> has all the right indents and stuff.

Even then, everyone has a style. My bud writes

  if ($x) 
  { do_stuff();
  }
  else 
  { do_other_stuff();
  }

I despise that, and would rather write 

  if ($x) {
     do_stuff();
  } else {
     do_other_stuff()
  }    

or even

  $x ? do_stuff() : do_other_stuff;

or *maybe* even

  if ($x) { do_stuff() } else { do_other_stuff() }

on a bad day, but those bare else's kill me.
Never mind that it's possibly the only thing I strongly disagree with
Larry on. (Let us all honor Larry in a moment of silent grins for the
freedom to do any of the above! TMTOWTDI!)

But honestly, does it matter? It works, and I can read it, and anyone
that comes behind him will understand what it's doing, probably more
surely that with the trinary operator, which isn't really ideal for a
void context, anyway.

Heck, if we really wanted to be obtuse we could hack together a
one-line function dispatch, like

  &{ $x ? *do_stuff : *do_other_stuff }();

or even 

  ( $x ? *do_stuff : *do_other_stuff )->();

but who wants to maintain that if it isn't necessary?
and all gods forbid something like 

  ( $x && *do_stuff || *do_other_stuff )->();

Yet I've seen such chicanery, and usually kicked myself for writing it
just a very few short months later, lol....

And what if the next modification to the code required arguments
(*different* ones!) to be passed to the functions?

But hey, it works for now, and it *IS* a good way to learn new
tricks....

BTW, would anyone out there like explanations for any of those last
bits of hackery? :)

Paul

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to