我需要使用超過10000列的Array來處理資料,以下是簡化程式碼後發現的問題。
我寫了兩個測試函數腳本,存取10001個Array元素。
第一個測試函數腳本 Test.array.for 可以正常編譯,但是第二個測試函數腳本 Test.array.list 卻不能編譯。
第一個測試函數腳本 Test.array.for 如下:
//測試函數腳本:Test.array.for
variable: number_of_string(10000);
array:str_array[]("");
array_setmaxindex(str_array, number_of_string+1);
variable:i(0);
for i=0 to number_of_string
begin
str_array[i] = "test";
end;
第二個測試函數腳本 Test.array.list如下:
PS. 該程式碼為示意版本,完整版如附件。
//測試函數腳本:Test.array.list
variable: number_of_string(10000);
array:str_array[]("");
array_setmaxindex(str_array, number_of_string+1);
str_array[0] = "test";
str_array[1] = "test";
str_array[2] = "test";
...
Test.array.list 在編譯的時候會出現下列錯誤:
Test.array.list-1-1ExitCode: 1 StdOut: StdErr: System\XSSystem\Tmp\466af53210cd49ff9679f742c8b914fb.cpp: In member function 'virtual void DJScript::Function::C76760ebfc4c0440491123ad81c783fbd::OnEvalBar()': System\XSSystem\Tmp\466af53210cd49ff9679f742c8b914fb.cpp:10126:1: internal compiler error: Segmentation fault } ^ Please submit a full bug report, with preprocessed source if appropriate. See <mingw-w64-public@lists.sourceforge.net> for instructions.
我有試著只使用 10個Array元素,編譯是沒問題的:
//測試函數腳本:Test.array.list
//只使用 10 個 str_array元素
variable: number_of_string(10000);
array:str_array[]("");
array_setmaxindex(str_array, number_of_string+1);
str_array[0] = "test";
str_array[1] = "test";
str_array[2] = "test";
str_array[3] = "test";
str_array[4] = "test";
str_array[5] = "test";
str_array[6] = "test";
str_array[7] = "test";
str_array[8] = "test";
str_array[9] = "test";
請問小幫手,該編譯錯誤應該如何避免呢?
2 評論