Message-ID: <147BBF8976F0D211888508002BA60B66015A663B@mail8.ntu.edu.sg> From: #CHUA CHAI GUAN# To: "'djgpp AT delorie DOT com'" Subject: pointer problem Date: Wed, 19 May 1999 09:33:03 +0800 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2232.9) Content-Type: text/plain Reply-To: djgpp AT delorie DOT com To whom it may concern, a) What's the syntax in JDGPP compiler to call a function to a pointer ? C:\CCG\gann\gann>make -k gcc -O6 -Wall -fstrict-prototypes -funroll-loops -finline-functions -c NN.cpp NN.cpp: In method `void NN::trainBP(int, float **, int *, int = 1, int = 1, enum trainAlgs = STD_GRAD_DESC)': NN.cpp:534: must use .* or ->* to call pointer-to-member function in `fp (...)' NN.cpp:540: must use .* or ->* to call pointer-to-member function in `fp (...)' make.exe: *** [NN.o] Error 1 make.exe: Target `all' not remade because of errors. I tried to fix it by adding the .* in front of fp. It gave the following problem :- C:\CCG\gann\gann>make -k gcc -O6 -Wall -fstrict-prototypes -funroll-loops -finline-functions -c NN.cpp NN.cpp: In method `void NN::trainBP(int, float **, int *, int = 1, int = 1, enum trainAlgs = STD_GRAD_DESC)': NN.cpp:534: parse error before `.*' NN.cpp:540: parse error before `.*' make.exe: *** [NN.o] Error 1 make.exe: Target `all' not remade because of errors. What's ur advices ? Attached herewith the part of the program //void NN::trainBP(int patCount, float **patterns, int *targets, int iterations=1, int shuffle=1, void *trainFct(float *input, int target)) { void NN::trainBP(int patCount, float **patterns, int *targets, int iterations=1, int shuffle=1, trainAlgs trainAlg = STD_GRAD_DESC) { // Find the apropriate function pointer to the training algorithm function. void (NN::*fp)(float *, int); switch (trainAlg) { case STD_GRAD_DESC: fp = &bp; break; case PSEUDO_NEWTON: fp = &pnaBP; break; default: fprintf(stderr, "NN::trainBP: Error (Unknown training algorithm)\n"); fflush(stderr); exit(1); } for (int it=0; it