저는 Isis2 (C# .NET) 라이브러리와 대화하는 C++/CLI 응용 프로그램을 가지고 놀고 있습니다. 아래의 코드에서 "경고 3 C4538 : 'cli :: array ^'오류가 발생합니다.이 유형의 const/volatile 한정자는 지원되지 않습니다." 나는 이것을 던진 줄을 강조했다. 나는 당황 스럽다 : 이것은 배열이 없으며 const 나 volatile을 사용하지도 않는다! 어떤 제안?C++/CLI로보기에 부적절한 컴파일 경고
// CPlusPlus.cpp : main project file.
#include "stdafx.h"
#using <IsisLib.dll>
using namespace Isis;
using namespace System;
void GotNewView(View^ v)
{
Console::WriteLine("Got a new view: " + v->ToString());
}
public delegate void GotAnInt_T (int i);
void GotAnInt(int i)
{
Console::WriteLine("Got an int: {0}", i);
}
public delegate void GotTwo_T (String ^s, double d);
void GotTwo(String^ s, double d)
{
Console::WriteLine("Got a string: <{0}> and a double: {1}", s, d);
}
public delegate void SendsReply_T(int i);
void SendsReply(int i)
{
thisGroup()->Reply(-i);
}
int main(array<System::String ^> ^args)
{
IsisSystem::Start();
Group ^g = gcnew Group("test"); <============= THIS LINE
g->RegisterViewHandler(gcnew ViewHandler(GotNewView));
g->Handlers[0] += gcnew GotAnInt_T(GotAnInt);
g->Handlers[0] += gcnew GotTwo_T(GotTwo);
g->Handlers[1] += gcnew SendsReply_T(SendsReply);
g->Join();
g->Send((int^)0, 12345);
g->Send((int^)0, "Aardvarks are animals", 78.91);
Console::WriteLine("After Send, testing Query");
Collections::Generic::List<int>^ results = gcnew Collections::Generic::List<int>();
int nr = g->Query(Group::ALL, 1, 6543, gcnew EOLMarker(), results);
IsisSystem::WaitForever();
return 0;
}
'Group' 유형에는 휘발성 인 배열 유형 구성원이 있습니까? –
예, C# 코드에는 volatile로 선언 된 부울 벡터가 있습니다. 그래서 g -> foo가 휘발성이 될 수있는 필드 foo가 있습니다. 그러나 과제를 없애고 gcnew Group ("Foo")을 수행하면 오류가 사라집니다. 그래서 문제가 과제와 관련 있다고 가정하고 있었는데 ... 내가 틀렸어? –
불공정! 나는 컴파일러 버그로 판명 된 것에 대해 질문을 게시하고 누군가가 "잘 조사되지 않은"질문을 던집니다. 그 일을 한 사람에게 제 질문이 있습니다. 어떻게 물어 봐도 될까요? 이걸 조사 했습니까? 원한다면 문제를 재현 할 수 있도록 게시 코드를 작성했습니다. 나에게 이것이 상황에서 벗어난 코드 조각보다 더 낫다. 특히 이것은 잘못된 경고 메시지를 유발하는 정확한 코드로 밝혀졌다. –