Re: How do I inhibit warning 528?

From: Alan Balmer (albalmer_at_att.net)
Date: 01/28/04


Date: Wed, 28 Jan 2004 08:11:56 -0700

On 27 Jan 2004 23:08:03 -0800, robertsadress@hotmail.com (Robert)
wrote:

>> #define MY_SPECIAL_VALUE 3
>>
>> in the header file, then each file that needs it declares
>>
>> static int my_const_var = MY_SPECIAL_VALUE;
>>
>> (Actually, I'm suspicious that this program doesn't even need a
>> variable, but can't tell without seeing the rest of it.)
>
>I guess that it could conflict if the 'const' is overridden somehow,
>otherwise it is ok, eccept that it is unused in file3.c.
>
>'#define MY_SPECIAL_VALUE 3' has two major drawbacks as I see it:
>1) No type checking.
How so? When you declare "static int whatever_name_you_like" the
compiler will type-check no matter how you initialize it.

>2) Filths down the global name space.
Pick whatever name you like.

-- 
Al Balmer
Balmer Consulting
removebalmerconsultingthis@att.net