Open friedrichromstedt opened 4 years ago
I always hated these cases where the compiler misinterprets an "obvious" syntax for some other syntax; C++ is simply too complex…
I would probably work around that by instantiating a Shape1
variable, instead of an int
variable. Maybe someone else (Ulli?) knows other ways to make the line (which you could helpfully mark with a // <== error happens here
comment BTW) work.
PS: Tip of the day for getting English messages for bug reports etc.: Prefix your command (here make
) with LANG=C
.
I would probably work around that by instantiating a
Shape1
variable, instead of anint
variable. Maybe someone else (Ulli?) knows other ways to make the line (which you could helpfully mark with a// <== error happens here
comment BTW) work.
Instantiating a Shape1
variable and using this during instantiating the MultiArray<1, float>
works for me. Thanks for the hint!
int length = 43;
Shape1 shapedr(length);
MultiArray<1, float> shape1dr(shapedr);
cout << "shape1dr.shape() = " << shape1dr.shape() << "." << endl;
I've edited my post to include the comment you proposed.
PS: Tip of the day for getting English messages for bug reports etc.: Prefix your command (here
make
) withLANG=C
.
Well, I am using Visual Studio here ...
Friedrich
While acquainting myself with Vigra, I stumbled upon some problem with 1-dimensional MultiArrays.
I am trying to initialise
MulitArray<1, float>
withShape1(<length>)
.<length>
is either a plain number, or the name of an integer variable.The initialisation works fine when using a literal number, but fails in the end when using a variable.
I am providing below a small code to reproduce the behaviour.
The compiler in use is VS 2019, using the VS 2015 (v140) toolset, with target platform 10.0.18362.0.
In the code below, the second paragraph in
int main()
is the most relevant. Both initialisation ofMultiArray<1, float>
compile fine, also the one referencing a non-existing variable namedxyz
. However, the commented-out code path in the middle of the paragraph does not compile. Notice also that the two initialisation lines yield warnings (these are in German):Telling (approx.): Function with prototype has not been called (was meant a variable definition?)
Things are working as expected with two-dimensional MulitArrays, as demonstrated in the last two paragraphs of the
main
function. Also the first paragraph using a verbatim number as argument forShape1
yields no surprises.This is with Vigra-1.11.1; I tried also with a github version from 2020-08-12, ending up with the same results.
The test code is: