in reply to Re: Help - I'm a C programmer
in thread Help - I'm a C programmer
You should always avoid globals at all costs; it's just bad programming in any language.Is wrongheadedness like most blanket statements in programming ("never use a goto!" "always enter loops at the top and exit at the bottom!" etc..).
You should avoid globals<super>*</super> wherever possible, but not go through great pains and contortions to do so. Sometimes they're more appropriate than passing parameters to every function in a system to handle every possible need that may require them. For our C programmer, errno is an example where having a variable that has a "global" scope is much more appropriate than having every function which might do I/O receive it (or a pointer) as a parameter and pass it around during exception handling.
<super>*</super>I'm including file-scoped lexicals and package variables in this category and not the ${special_character} variables. Those, for the most part, are evil.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Help - I'm a C programmer
by Masem (Monsignor) on Jun 17, 2001 at 21:08 UTC | |
by tilly (Archbishop) on Jun 18, 2001 at 19:29 UTC | |
by John M. Dlugosz (Monsignor) on Jun 18, 2001 at 05:14 UTC | |
|
Re: Re: Re: Help - I'm a C programmer
by Brovnik (Hermit) on Jun 17, 2001 at 22:55 UTC | |
by Sifmole (Chaplain) on Jun 18, 2001 at 16:21 UTC |