heg@otter.hpl.hp.com (Helena Gilchrist) (06/19/91)
How can type checking be overridden in C++?
At first I thought that it meant the ellipses in function declarations,
as described in the Lippman book on page 114:
Using the ellipses in the function declaration suspends type checking
for this function.
I wanted to verify this and made the following example:
file1: extern void test_func(...);
main()
{
int i=0;
test_func(i);
}
file2: void test_func(int k) {}
I compiled it with HP C++ and the linker generated the following message:
ld: Undefined external - test_func()
The C++ translator generated two different function names for test_func:
extern void test_func(...) ---> test_func__Fve
test_func(i) ---> test_func__Fve
void test_func(int k) ---> test_func__Fi
Then I changed the first line in file1 to:
extern void test_func(int);
After this modification I could compile and link my test program.
How can I avoid type checking?
Please send reponses to this note to:
rolfh@hpbbn.bbn.hp.com
or ROLF_HAAS@hpb100.desk.hp.com