Re: __gc array initializers?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Tom (noname_at_noprovider.nodomain)
Date: 01/20/05


Date: Wed, 19 Jan 2005 21:08:46 -0600

Tomas,
    You are correct - I was trying to initialize a class array variable that
was not static.
    Declaring the variable as static turned out to be the correct thing to
do anyway.
    Thanks for the help.

    -- Tom

"Tomas Restrepo (MVP)" <tomasr@mvps.org> wrote in message
news:%23o2a9J49EHA.208@TK2MSFTNGP12.phx.gbl...
> Tom,
> <<
> Yes - that is what I am trying to do, buy it gives me a compile error in
> VC++.NET 2003:
> "error C3845: only static data members can be initialized inside a __gc
> class or value type"
>>>
>
> Are you trying to initialize inline a non-static class member like this?
> If
> so, no, you are right that won't work (and won't work for unmanaged types
> either in C++ classes, either)
>
> --
> Tomas Restrepo
> tomasr@mvps.org
>
>



Relevant Pages

  • Re: static array initialization
    ... It is initialized before the program begins execution therefore it ... from this group as to the style/correctness of declaring a static ... The solution is to use a char, in this case "static char option =3D 0" ... variable will be initialize to 0. ...
    (comp.lang.c)
  • Re: question on scope of a variable
    ... >>I've tried declaring a public variable in a module of my project in hope ... >>to be able to initialize it, or have access to it's value if it's ... Yes, it is, but it seems to have a lifetime which I don't understand, and at ... some form or routine can "see" it, ...
    (microsoft.public.word.vba.general)
  • question on scope of a variable
    ... I've tried declaring a public variable in a module of my project in hope ... to be able to initialize it, or have access to it's value if it's ... While this compiles for me, I'm getting a runtime error that indicates the ... I did try declaring it using the STATIC command in the module but the ...
    (microsoft.public.word.vba.general)
  • Re: array problem
    ... Peter - I understood that in addition to declaring the array I had ... to initialize each element also. ... DefaultStyledDocument[] doc; ...
    (comp.lang.java.programmer)
  • Re: which is better practice
    ... > That's more typing. ... I like the ability to initialize in the same ... I do too, but in general, it's the declaring variables in the middle ...
    (comp.lang.perl.misc)