Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: Handling 'i...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 17 Topic 26103 of 26972
Post > Topic >>

Re: Handling 'initializer element not constant' error

by Keith Thompson <kst-u@[EMAIL PROTECTED] > May 7, 2008 at 01:38 PM

richard@[EMAIL PROTECTED]
 (Richard Tobin) writes:
> In article
<9c2b13d5-b18d-498e-aec8-d239d0bb3a23@[EMAIL PROTECTED]
>,
>  <vippstar@[EMAIL PROTECTED]
> wrote:
>
>>> It's a pity there isn't a standard way to get initialisation code run.
>
>>I don't think it's that much of a problem. Well-designed code wouldn't
>>use global variables.
>
> You're letting a slogan override your common sense.  There are many
> cases of global variables that are completely reasonable.
>
> For example, I want to convert between ISO Latin-5 (an 8-bit character
> set) and Unicode code points (which can be considered to have 2^16
> characters for this purpose).  To do this, I have a table of 256
> entries mapping Latin-5 to Unicode, and I want to build the reverse
> table at start-up.  These two global variables, latin_5_to_unicode and
> unicode_to_latin_5, have no objectionable properties.
[...]

Without resurrecting the unresolved argument over the definition of
"variable" I'll note that your global objects latin_5_to_unicode and
unicode_to_latin_5 presumably do not vary once they've been
initialized.  Global objects whose values are never modified during
program execution are less problematic than global objects whose
values can vary over time.  ("Global" here refers to file scope and
static duration, more or less.)

-- 
Keith Thompson (The_Other_Keith) <kst-u@[EMAIL PROTECTED]
>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
 




 17 Posts in Topic:
Handling 'initializer element not constant' error
Gowtham <gowthamgowtha  2008-05-07 07:14:35 
Re: Handling 'initializer element not constant' error
viza <tom.viza@[EMAIL   2008-05-07 07:43:00 
Re: Handling 'initializer element not constant' error
Willem <willem@[EMAIL   2008-05-07 15:20:02 
Re: Handling 'initializer element not constant' error
richard@[EMAIL PROTECTED]  2008-05-07 17:01:29 
Re: Handling 'initializer element not constant' error
vippstar@[EMAIL PROTECTED  2008-05-07 10:29:14 
Re: Handling 'initializer element not constant' error
richard@[EMAIL PROTECTED]  2008-05-07 19:21:06 
Re: Handling 'initializer element not constant' error
Keith Thompson <kst-u@  2008-05-07 13:38:56 
Re: Handling 'initializer element not constant' error
vippstar@[EMAIL PROTECTED  2008-05-07 10:31:30 
Re: Handling 'initializer element not constant' error
vippstar@[EMAIL PROTECTED  2008-05-07 13:49:08 
Re: Handling 'initializer element not constant' error
richard@[EMAIL PROTECTED]  2008-05-07 22:29:06 
Re: Handling 'initializer element not constant' error
Ben Pfaff <blp@[EMAIL   2008-05-07 15:30:43 
Re: Handling 'initializer element not constant' error
richard@[EMAIL PROTECTED]  2008-05-07 22:40:52 
Re: Handling 'initializer element not constant' error
Ben Pfaff <blp@[EMAIL   2008-05-07 15:46:39 
Re: Handling 'initializer element not constant' error
dj3vande@[EMAIL PROTECTED  2008-05-07 22:44:24 
Re: Handling 'initializer element not constant' error
Flash Gordon <spam@[EM  2008-05-08 06:56:18 
Re: Handling 'initializer element not constant' error
Peter Nilsson <airia@[  2008-05-07 15:20:10 
Re: Handling 'initializer element not constant' error
Szabolcs Borsanyi <bor  2008-05-09 02:32:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:30:37 CDT 2008.