if ($var) {
$used++;
}
ANSI:
if ($var)
{
$used++;
}
I am aware that Perlers generally seem to prefer K&R style (perhaps because Larry Wall prefers it). I have a tendancy of coding in ANSI style. I note that there are some modules written in ANSI style (though, very few).
Will my preference come to haunt me one day? Anybody have any reasons why I should learn to adopt the K&R style? [ I am aware to follow the style of a given project when hacking in that project ]. Anybody have any reasons why I should stick with ANSI?
Thanks
Why K&R style for me (Score:2)
Re:Why K&R style for me (Score:1)
I'd have much less problem with K&R if so many folks didn't also use a two-space indentation...
... where
Re:Why K&R style for me (Score:1)
Anyway, in Perl it's not very common, at least not in the code I've stumbled upon. There's seldom use for that kind of structure when most stuff is garbage collected or can be made to clean up automatically (like file h
Re:Why K&R style for me (Score:1)
That said, the same structure confusion can happen just as easily in nested loops.
foreach $a (@array) {}
(*shrugs*)
Which? (Score:1)
Will it? (Score:1)
I wouldn't call it "haunt", but I'm more fond of submitting patches for my kind of coding style (K&R) than for others...
Others may suffer from the same symptom, even if unaware of it... :-)
ANSI Perl (Score:2)
-sam
My style. (Score:2)
I flip/flop between cuddled and uncuddled else's. In the end, your choice won't come back to bite you unless you decide to become a religious bigot about it.
Just don't do this.
Re:My style. (Score:1)
Complex conditionals. (Score:2)
Re:Complex conditionals. (Score:1)
Complex styles (Score:2)
If you ignore the pros/cons each style and just apply one to all your code like a cookie-cutter you're losing their benefits in the name of the