473,385 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

__gc array initializers?

Tom
Does anyone know if the 2005 version of C++.NET will support the traditonal
C-style
way of initializing arrays at the declaration? [avoiding the dreaded
C3184].

-- Tom
Nov 17 '05 #1
4 1666
Hi Tom,
Does anyone know if the 2005 version of C++.NET will support the traditonal C-style
way of initializing arrays at the declaration? [avoiding the dreaded
C3184].


What do you mean by this? This?

String* ar __gc[] = { S"asdasd", S"adadsasd", S"scasdsda" };

That already works.... or what?

--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #2
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"

-- Tom

"Tomas Restrepo (MVP)" <to****@mvps.org> wrote in message news:OO**************@tk2msftngp13.phx.gbl...
Hi Tom,
Does anyone know if the 2005 version of C++.NET will support the

traditonal
C-style
way of initializing arrays at the declaration? [avoiding the dreaded
C3184].


What do you mean by this? This?

String* ar __gc[] = { S"asdasd", S"adadsasd", S"scasdsda" };

That already works.... or what?

--
Tomas Restrepo
to****@mvps.org

Nov 17 '05 #3
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
to****@mvps.org
Nov 17 '05 #4
Tom
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)" <to****@mvps.org> wrote in message
news:%2***************@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
to****@mvps.org

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: herbertF | last post by:
Hi guys, In a program (not my own) I encountered the declaration of a constant pointer to an array consisting of two other const pointers to arrays. Not quite sure why they do it so complicated,...
3
by: masood.iqbal | last post by:
Hi, I have seen at least two ways to initialize multi-dimensional arrays in C. One of the ways is shown in a sample code snippet below. The other way does not make use of any intermediate...
0
by: Robert A Riedel | last post by:
In a module DATA.CPP, when attempting to initialize a __gc array as follows: // // Begin sample ... // // // Yes, I include all of the correct assemblies, including MSCORLIB.DLL and all of...
2
by: Robert A Riedel | last post by:
This is a repost of a question that received no answer. In a module DATA.CPP, when attempting to initialize a __gc array as follows: // // Begin sample ... // // // Yes, I include all of...
1
by: TGF | last post by:
Hello, I am calling a Filestream::Read() (i.e. fs->Read(arg1, arg2, arg3)). The problem is I have a pointer to an unsigned char block of memory and would like to fill it with the call to 'Read'....
1
by: Bern McCarty | last post by:
If I have a class that implements the singleton pattern like so: public __gc class AppManager { private: AppManager(); // private constructor public: virtual ~AppManager(); static AppManager*...
1
by: Bern McCarty | last post by:
I am using MEC++ in VC 7.1. I had a method on a __gc object that looked like this: __property System::UInt32 get_MyProperty(void) { System::Byte __pin * pinBytes = &m_byteArray; // entire...
6
by: Lupina | last post by:
#pragma once using namespace System; __gc class CWords { public:
2
by: microsoft | last post by:
Hi All, I am fairly new to Managed C++ extensions. I started trying to implement a interface defined in a C# project, in C++. The problem was with passing value arrays from c# to c++. I found...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.