XITITKUN%DDATHD21.BITNET@MITVMA.MIT.EDU (01/09/90)
We are currently using the GNU C++ compiler version 1.34.2.
While using the compiler I discovered the following two
problems:
1) The sample program
#include <stdio.h>
main()
{
printf("SIZE: %d\n", sizeof( typeof(int[3]) ) );
}
compiles and produces the expected output: `SIZE: 12'.
I would expect the following similar program to produce
an output like `SIZE: 4', but actually, the program doesn't
compile at all.
#include <stdio.h>
main()
{
printf("SIZE: %d\n", sizeof(typeof(* typeof(int[3]) ) ) );
}
Starting the compiler with: bin/g++ demo.cc -o demo
results in the following error message:
In function int main ():
demo.cc:5: parse error before `)'
2) Initializing a struct parameter with a default value doesn't work,
though I could find nothing in the documentation which tells me that
this is not supposed to work. The following sample program
#include <stdio.h>
struct example
{ int a;
float b;
};
void dummy(example demo ={5, 3.1415})
{ printf("Result: %d %f\n", demo.a, demo.b);
}
main()
{ example yyy;
example xxx = {1, 1.0};
dummy( yyy );
dummy();
dummy( xxx );
}
was compiled with: bin/g++ demo.cc -o demo
and produced the following result:
Result: 0 0.000000
Result: 0 0.000000
Result: 1 1.000000
instead of:
Result: 0 0.000000
Result: 5 3.141400
Result: 1 1.000000
which I think is the correct answer.
Thomas Kunz XITITKUN@DDATHD21.BITNET
,