[dev] Re: Local vs global variables

From: QUINTIN Guillaume <coincoin169g_AT_gmail.com>
Date: Fri, 6 Nov 2009 21:18:50 +0100

> Was that someone Niklaus Wirth? ... oh, I forgot: He would not
> recommend any C at all. ;-)

No he is my boss at my work, we were discussing, and I said that
sometimes I use global variables and everybody laughed at me.

> If there is a good reason, i will not bar you from breaking the rule.

As in dwm, when you have the list of monitors used in a lot of
functions why not make them global ? In my case it is the width and
height of the terminal.

> Those are the kinds of people who say, Dijkstra sayeth
> we must not use goto, so we musnt!

It is rare but sometimes I use a goto.

> If you don't understand why globals can be a bad software
> engineering practice, and you just shun them for the sake of
> propriety, well, then, go learn Java or something; you'll fit right in.

I agree with you and with
> Still, like the venerable goto, sometimes, not often,
> it's the best tool at hand.
and
> It's like with everything: It depends on the case.

> Is he sure he never uses global variables?

That I don't know, he did not tell me, but I am sure he uses them.

Regards.
Received on Fri Nov 06 2009 - 20:18:50 UTC

This archive was generated by hypermail 2.2.0 : Fri Nov 06 2009 - 20:24:03 UTC