Re: [dev] Local vs global variables

From: Kris Maglione <maglione.k_AT_gmail.com>
Date: Fri, 6 Nov 2009 14:33:04 -0500

On Fri, Nov 06, 2009 at 07:19:30PM +0000, Anselm R Garbe wrote:
>2009/11/6 QUINTIN Guillaume <coincoin169g_AT_gmail.com>:
>> Someone just told me that, when writing C code, one should NOT use ANY
>> global variables. He did not tell me to use global variables as few as
>> possible, he did tell me to use ABSOLUTELY NO global variables in any
>> kind of C code (single program, library, OS kernel, any kind there is
>> ...)
>>
>> What do you think about that ?
>
>Is he sure he never uses global variables? What about our old friend errno?

errno is evil. And on GNU bastard systems from hell, it's not
even a variable, it's a macro to a dereferenced pointer returned
from a function call to a thread local storage cell. Plan 9
doesn't even have errno, it has a syscall that returns the error
string from the last system call.

-- 
Kris Maglione
The first symptom of love in a young man is shyness; the first symptom
in a woman, it's boldness.
	--Victor Hugo
Received on Fri Nov 06 2009 - 19:33:04 UTC

This archive was generated by hypermail 2.2.0 : Fri Nov 06 2009 - 19:36:19 UTC