comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: variables in common blocks
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: variables in common blocks [message #53874 is a reply to message #53873] Fri, 04 May 2007 08:07 Go to previous messageGo to previous message
Maarten[1] is currently offline  Maarten[1]
Messages: 176
Registered: November 2005
Senior Member
On May 4, 2:42 pm, Lasse Clausen <l...@lbnc.de> wrote:

> If you have an easy solution on how to avoid common blocks, shoot. And
> why are common blocks bad? Is it the same reason "goto" statements are
> bad?

Common variables are really global variables. They allow a function to
have side effects, and make it hard to debug a program. For sanity's
sake try to avoid common blocks, unless you really have a good reason
to use them, and clearly label the variables in them as such, so that
you have a clear warning when dealing with them.

In general is it easier to pass variables as formal parameters.

The book I learnt C from started out with local variables, and only
mentioned that global variables even existed in chapter 6. By that
time I was acustomed to pass variables as function arguments, and
hardly ever used globals, except perhaps as a global program kill
switch in GUI applications. The Mac way of things infected me with
aonther (pseudo)Hungarian notation: all my globals have a name
starting with 'g', all constant start with 'k'. If you use a common
block, make sure you do something similar.

Maarten
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: limited angle CT
Next Topic: IDL number output format problem?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 19:10:07 PDT 2025

Total time taken to generate the page: 1.75631 seconds